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): def btn1_callback(channel):
logging.debug("PREV") logging.debug("PREV")
json = call('core.playback.get_time_position').json() json = call('core.playback.get_time_position').json()
position = json['result'] if (json['result'] < 4000):
if (position < 4):
call('core.playback.previous') call('core.playback.previous')
else: else:
call('core.playback.seek', '{ "time_position": 0 }') call('core.playback.seek', '{ "time_position": 0 }')
def btn2_callback(channel): def btn2_callback(channel):
logging.debug("PLAY/PAUSE") logging.debug("PLAY/PAUSE")
json = call('core.playback.get_time_position').json() json = call('core.playback.get_state').json()
state = json['result'] if (json['result'] == 'playing'):
if (state == 'playing'):
call('core.playback.pause') call('core.playback.pause')
else: else:
call('core.playback.play') 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 ### Spotify URLs
https://open.spotify.com/track/3jQyadhLTxpxadQlkFh2b8 https://open.spotify.com/track/3jQyadhLTxpxadQlkFh2b8
https://open.spotify.com/episode/1o8HWRR0mx5TfyxLlnKv8e https://open.spotify.com/episode/1o8HWRR0mx5TfyxLlnKv8e