Exception handling for BT-Player control, if no player available
This commit is contained in:
parent
8cf4e1da2c
commit
6388afa835
@ -50,17 +50,19 @@ def on_property_changed(interface, changed, invalidated):
|
|||||||
|
|
||||||
|
|
||||||
def on_mqtt_ctrl(client, userdata, message):
|
def on_mqtt_ctrl(client, userdata, message):
|
||||||
if message.topic == config.MQTT_TOPIC + "/PLAY":
|
try:
|
||||||
player_iface.Play()
|
if message.topic == config.MQTT_TOPIC + "/PLAY":
|
||||||
elif message.topic == config.MQTT_TOPIC + "/PAUSE":
|
player_iface.Play()
|
||||||
player_iface.Pause()
|
elif message.topic == config.MQTT_TOPIC + "/PAUSE":
|
||||||
elif message.topic == config.MQTT_TOPIC + "/TRACK_PREV":
|
player_iface.Pause()
|
||||||
player_iface.Previous()
|
elif message.topic == config.MQTT_TOPIC + "/TRACK_PREV":
|
||||||
elif message.topic == config.MQTT_TOPIC + "/TRACK_NEXT":
|
player_iface.Previous()
|
||||||
player_iface.Next()
|
elif message.topic == config.MQTT_TOPIC + "/TRACK_NEXT":
|
||||||
else:
|
player_iface.Next()
|
||||||
logger.info(message.topic)
|
else:
|
||||||
|
logger.info(message.topic)
|
||||||
|
except AttributeError:
|
||||||
|
logger.warning("Player control impossible due to no player available.")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
report.stdoutLoggingConfigure(((config.APP_NAME, config.LOGLVL), ), fmt=config.formatter)
|
report.stdoutLoggingConfigure(((config.APP_NAME, config.LOGLVL), ), fmt=config.formatter)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user