Skip to content
Snippets Groups Projects
Commit 050bdfd9 authored by 42loop's avatar 42loop
Browse files

fixed playbackstatus publisher

parent d8c611b6
No related branches found
No related tags found
No related merge requests found
......@@ -62,6 +62,18 @@ def publish(suffix,val,more):
mqttlogging("MQTT: Publishing @"+fulltopic+": "+jsonstr)
mqc.publish(fulltopic,jsonstr,qos=0,retain=True)
def publishstat(suffix,val,more):
global topic,mqc
robj={}
robj["val"]=val
if more is not None:
robj.update(more)
jsonstr=json.dumps(robj)
fulltopic="stat/"+topic+suffix
mqttlogging("MQTT: Publishing @"+fulltopic+": "+jsonstr)
mqc.publish(fulltopic,jsonstr,qos=0,retain=True)
#
# Set and publishes the playback state. Publishes more info if
# the state is "playing"
......@@ -109,9 +121,9 @@ def publishprogress():
def publishstatus():
global player
if not player.isPlaying():
publish("playstate","0")
publishstat("playstate","%i" % 0, None)
else:
publish("playstate","1")
publishstat("playstate","%i" % 1, None)
#
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment