Last active
July 7, 2017 00:02
-
-
Save charrismatic/cf7e658e17fe019d6ef68f523d9d8873 to your computer and use it in GitHub Desktop.
Spotify API - Keep computer awake if currently playing
This file contains 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
# Machine currently playing goes into sleep mode during playback | |
# A simple curl request to see if this machine is currently active | |
# If true reset wake timer and set timer to run again at t-1 wake timer | |
# Hooks: Run script at spotify application launch and run at machine wake | |
# https://developer.spotify.com/web-api/endpoint-reference/ | |
# ref: https://developer.spotify.com/web-api/console/get-user-player/ | |
# example: | |
curl -X GET "https://api.spotify.com/v1/me/player" -H "Accept: application/json" -H "Authorization: Bearer <API-KEY>" | |
# returns: | |
{ | |
"timestamp" : 1497819542619, | |
"progress_ms" : 184958, | |
"is_playing" : true, | |
"device" : { | |
"id" : "", | |
"is_active" : true, | |
"is_restricted" : false, | |
"name" : "computer-id", | |
"type" : "Computer", | |
"volume_percent" : 90 | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment