diff --git a/README.md b/README.md index 4af3ee5..f504826 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,7 @@ The addon listens to the following topics (prefixed with the configured topic pr - "toggle" to toggle between play and pause - "next" to play the next track - "previous" to play the previous track +* command/progress: A string having format hours:minutes:seconds. Changes position of currently played file See also diff --git a/service.mqtt/service.py b/service.mqtt/service.py index af4cd2d..fd7de3f 100644 --- a/service.mqtt/service.py +++ b/service.mqtt/service.py @@ -206,6 +206,11 @@ def processplaybackstate(data): elif data=="previous": player.playprevious() +def processprogress(data): + hours, minutes, seconds = [int(i) for i in data.split(":")] + time = hours * 3600 + minutes * 60 + seconds + player.seekTime(time) + def processcommand(topic,data): if topic=="notify": processnotify(data) @@ -213,6 +218,8 @@ def processcommand(topic,data): processplay(data) elif topic=="playbackstate": processplaybackstate(data) + elif topic=="progress": + processprogress(data) else: mqttlogging("MQTT: Unknown command "+topic)