|
@@ -50,17 +50,19 @@ def on_property_changed(interface, changed, invalidated):
|
50
|
50
|
|
51
|
51
|
|
52
|
52
|
def on_mqtt_ctrl(client, userdata, message):
|
53
|
|
- if message.topic == config.MQTT_TOPIC + "/PLAY":
|
54
|
|
- player_iface.Play()
|
55
|
|
- elif message.topic == config.MQTT_TOPIC + "/PAUSE":
|
56
|
|
- player_iface.Pause()
|
57
|
|
- elif message.topic == config.MQTT_TOPIC + "/TRACK_PREV":
|
58
|
|
- player_iface.Previous()
|
59
|
|
- elif message.topic == config.MQTT_TOPIC + "/TRACK_NEXT":
|
60
|
|
- player_iface.Next()
|
61
|
|
- else:
|
62
|
|
- logger.info(message.topic)
|
63
|
|
-
|
|
53
|
+ try:
|
|
54
|
+ if message.topic == config.MQTT_TOPIC + "/PLAY":
|
|
55
|
+ player_iface.Play()
|
|
56
|
+ elif message.topic == config.MQTT_TOPIC + "/PAUSE":
|
|
57
|
+ player_iface.Pause()
|
|
58
|
+ elif message.topic == config.MQTT_TOPIC + "/TRACK_PREV":
|
|
59
|
+ player_iface.Previous()
|
|
60
|
+ elif message.topic == config.MQTT_TOPIC + "/TRACK_NEXT":
|
|
61
|
+ player_iface.Next()
|
|
62
|
+ else:
|
|
63
|
+ logger.info(message.topic)
|
|
64
|
+ except AttributeError:
|
|
65
|
+ logger.warning("Player control impossible due to no player available.")
|
64
|
66
|
|
65
|
67
|
if __name__ == "__main__":
|
66
|
68
|
report.stdoutLoggingConfigure(((config.APP_NAME, config.LOGLVL), ), fmt=config.formatter)
|