diff --git a/code/piplayer3.py b/code/piplayer3.py index ecd25ba..332aee4 100644 --- a/code/piplayer3.py +++ b/code/piplayer3.py @@ -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') diff --git a/notes.md b/notes.md index 96f1d48..099f7b9 100644 --- a/notes.md +++ b/notes.md @@ -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