diff --git a/resources/lib/kodimonitor.py b/resources/lib/kodimonitor.py index 5a8cf1fb..edde1457 100644 --- a/resources/lib/kodimonitor.py +++ b/resources/lib/kodimonitor.py @@ -64,8 +64,12 @@ class KodiMonitor(xbmc.Monitor): if method not in ('Playlist.OnAdd', 'Player.OnStop', 'Player.OnClear'): log.info("Method: %s Data: %s", method, data) - if data: - data = json.loads(data, 'utf-8') + try: + if data: + data = json.loads(data, 'utf-8') + except: + log.info("Error parsing message data: %s", data) + return if method == 'Player.OnPlay': self._on_play_(data) diff --git a/resources/lib/player.py b/resources/lib/player.py index bbb33085..6a8f94bb 100644 --- a/resources/lib/player.py +++ b/resources/lib/player.py @@ -215,8 +215,12 @@ class Player(xbmc.Player): try: runtime = int(runtime) except ValueError: - runtime = self.xbmcplayer.getTotalTime() - log.info("Runtime is missing, Kodi runtime: %s" % runtime) + try: + runtime = int(self.xbmcplayer.getTotalTime()) + log.info("Runtime is missing, Kodi runtime: %s" % runtime) + except: + runtime = 0 + log.info("Runtime is missing, Using Zero") # Save data map for updates and position calls data = { diff --git a/resources/lib/read_embyserver.py b/resources/lib/read_embyserver.py index 7d9b539e..9b9105f9 100644 --- a/resources/lib/read_embyserver.py +++ b/resources/lib/read_embyserver.py @@ -82,9 +82,23 @@ class Read_EmbyServer(): if len(self.download_threads) < self.download_limit: # Start new "daemon thread" - actual daemon thread is not supported in Kodi new_thread = DownloadThreader(queue, output) - new_thread.start() - self.download_threads.append(new_thread) - return True + + counter = 0 + worked = False + while counter < 10: + try: + new_thread.start() + worked = True + break + except: + counter = counter + 1 + xbmc.sleep(1000) + + if worked: + self.download_threads.append(new_thread) + return True + else: + return False else: log.info("Waiting for empty download spot: %s", len(self.download_threads)) xbmc.sleep(100)