Exception handling for BT-Player control, if no player available

This commit is contained in:
Dirk Alders 2024-02-26 19:17:40 +01:00
parent 8cf4e1da2c
commit 6388afa835

View File

@ -50,6 +50,7 @@ def on_property_changed(interface, changed, invalidated):
def on_mqtt_ctrl(client, userdata, message):
try:
if message.topic == config.MQTT_TOPIC + "/PLAY":
player_iface.Play()
elif message.topic == config.MQTT_TOPIC + "/PAUSE":
@ -60,7 +61,8 @@ def on_mqtt_ctrl(client, userdata, message):
player_iface.Next()
else:
logger.info(message.topic)
except AttributeError:
logger.warning("Player control impossible due to no player available.")
if __name__ == "__main__":
report.stdoutLoggingConfigure(((config.APP_NAME, config.LOGLVL), ), fmt=config.formatter)