production version (with 20s workaround)

This commit is contained in:
2017-10-11 17:12:16 +02:00
parent b46a20f6f9
commit 896b62de57
2 changed files with 7 additions and 5 deletions
+3 -5
View File
@@ -88,17 +88,15 @@ def list_files(dir):
def btn1_callback(channel):
logging.debug("PREV")
json = call('core.playback.get_time_position').json()
position = json['result']
if (position < 4):
if (json['result'] < 4000):
call('core.playback.previous')
else:
call('core.playback.seek', '{ "time_position": 0 }')
def btn2_callback(channel):
logging.debug("PLAY/PAUSE")
json = call('core.playback.get_time_position').json()
state = json['result']
if (state == 'playing'):
json = call('core.playback.get_state').json()
if (json['result'] == 'playing'):
call('core.playback.pause')
else:
call('core.playback.play')
+4
View File
@@ -177,6 +177,10 @@ curl -X POST -H Content-Type:application/json -d '{"jsonrpc": "2.0", "id": 1, "m
curl -X POST -H Content-Type:application/json -d '{ "method": "core.playback.get_state", "jsonrpc": "2.0", "id": 1 }' http://192.168.1.142:6680/mopidy/rpc
### Spotify URLs
https://open.spotify.com/track/3jQyadhLTxpxadQlkFh2b8
https://open.spotify.com/episode/1o8HWRR0mx5TfyxLlnKv8e