From 42678620c672ebb5814f85a1f458afb47e5e3fa0 Mon Sep 17 00:00:00 2001 From: badaix Date: Sat, 17 Feb 2024 20:10:26 +0100 Subject: [PATCH] Improve mopidy connect handling --- server/etc/plug-ins/meta_mopidy.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/server/etc/plug-ins/meta_mopidy.py b/server/etc/plug-ins/meta_mopidy.py index c695b9bb..1c3ff6d2 100755 --- a/server/etc/plug-ins/meta_mopidy.py +++ b/server/etc/plug-ins/meta_mopidy.py @@ -94,9 +94,13 @@ def __init__(self, params): def websocket_loop(self): logger.info("Started MopidyControl loop") while True: - self.websocket.run_forever() - sleep(1) - logger.info("Ending MopidyControl loop") + try: + self.websocket.run_forever() + sleep(2) + except Exception as e: + logger.info(f"Exception: {str(e)}") + self.websocket.close() + # logger.info("Ending MopidyControl loop") def extractImageUrl(self, track_uri, jmsg): url = None