Exception handling for BT-Player control, if no player available
This commit is contained in:
parent
8cf4e1da2c
commit
6388afa835
@ -50,6 +50,7 @@ def on_property_changed(interface, changed, invalidated):
|
|||||||
|
|
||||||
|
|
||||||
def on_mqtt_ctrl(client, userdata, message):
|
def on_mqtt_ctrl(client, userdata, message):
|
||||||
|
try:
|
||||||
if message.topic == config.MQTT_TOPIC + "/PLAY":
|
if message.topic == config.MQTT_TOPIC + "/PLAY":
|
||||||
player_iface.Play()
|
player_iface.Play()
|
||||||
elif message.topic == config.MQTT_TOPIC + "/PAUSE":
|
elif message.topic == config.MQTT_TOPIC + "/PAUSE":
|
||||||
@ -60,7 +61,8 @@ def on_mqtt_ctrl(client, userdata, message):
|
|||||||
player_iface.Next()
|
player_iface.Next()
|
||||||
else:
|
else:
|
||||||
logger.info(message.topic)
|
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