From e0556516030a206f95d7cf0e57d75bd298271bdc Mon Sep 17 00:00:00 2001
From: David Trattnig <david.trattnig@o94.at>
Date: Fri, 15 May 2020 20:16:24 +0200
Subject: [PATCH] Fix and verbose exception handling.

---
 modules/scheduling/calendar.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/modules/scheduling/calendar.py b/modules/scheduling/calendar.py
index 189b86fd..073a1b88 100644
--- a/modules/scheduling/calendar.py
+++ b/modules/scheduling/calendar.py
@@ -154,7 +154,7 @@ class AuraCalendarService(threading.Thread):
             self.queue.put(result)
         except Exception as e:
             # Release the mutex
-            self.logger.warning("Fetching aborted due to: %s" % str(e))
+            self.logger.warning("Fetching aborted due to: %s" % str(e), e)
             self.queue.put("fetching_aborted " + str(e))
 
         # terminate the thread
@@ -255,10 +255,9 @@ class AuraCalendarService(threading.Thread):
             entry_db.artificial_playlist_id = playlist_db.artificial_id
             entry_db.entry_num = entry_num
 
-            if "file" in entry and duration in entry["file"]:
+            if "file" in entry and "duration" in entry["file"]:
                 # Convert nano-seconds to seconds
                 duration = int(float(entry["file"]["duration"]) / 1000000000) 
-            # except Exception:
             else:
                 # No duration means it's playing until the end of the schedule
                 self.logger.debug("Missing duration - setting duration of entry to end-of-schedule")
-- 
GitLab