Created
October 24, 2020 17:31
-
-
Save tabsl/2d2c8d1292d7d64048b267e849fcfabd to your computer and use it in GitHub Desktop.
get latest blink mini thumbnail
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# get latest blink mini thumbnail and save | |
# replace: YOUR_ACCOUNT_ID, YOUR_NETWORK_ID, YOUR_OWL_ID, YOUR_TIER, YOUR_TOKEN | |
# api info by https://github.com/MattTW/BlinkMonitorProtocol | |
# request new thumbnail | |
curl --request POST --url https://rest-YOUR_TIER.immedia-semi.com/api/v1/accounts/YOUR_ACCOUNT_ID/networks/YOUR_NETWORK_ID/owls/YOUR_OWL_ID/thumbnail --header 'token-auth: YOUR_TOKEN' | |
sleep 10 | |
# get thumbmail url | |
curl --request GET --url https://rest-YOUR_TIER.immedia-semi.com/api/v3/accounts/YOUR_ACCOUNT_ID/homescreen --header 'token-auth: YOUR_TOKEN' > blink.json | |
media=$(jq -r '.owls[0].thumbnail' blink.json) | |
# get thumbnail picture | |
url="https://rest-YOUR_TIER.immedia-semi.com$media.jpg" | |
wget --header="token-auth: YOUR_TOKEN" $url | |
# move picture | |
now="$(date +'%d%m%Y_%H%M%S')" | |
mv /home/users/latest.jpg /home/users/www/$now.jpg | |
filename=$(basename "$url") | |
mv $filename /home/users/www/latest.jpg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment