From f93fd75361a4d1c796526b6cf2b1ff648df539b1 Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Sat, 9 Jun 2018 00:20:15 -0500 Subject: [PATCH] Add emby.connected prop --- resources/lib/librarysync.py | 21 +++++++++++++++++++++ resources/lib/service_entry.py | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/resources/lib/librarysync.py b/resources/lib/librarysync.py index e7b34e47..89a95df7 100644 --- a/resources/lib/librarysync.py +++ b/resources/lib/librarysync.py @@ -404,6 +404,10 @@ class LibrarySync(threading.Thread): movies.count = 0 for all_movies in mb.get_items(view['id'], "Movie"): + + if should_stop(): + return False + movies.add_all("Movie", all_movies, view) log.debug("Movies finished.") @@ -418,6 +422,10 @@ class LibrarySync(threading.Thread): movies.count = 0 for boxsets in mb.get_items(None, "BoxSet"): + + if should_stop(): + return False + movies.add_all("BoxSet", boxsets) log.debug("Boxsets finished.") @@ -446,6 +454,10 @@ class LibrarySync(threading.Thread): # Initial or repair sync mvideos.count = 0 for all_mvideos in mb.get_items(view['id'], "MusicVideo"): + + if should_stop(): + return False + mvideos.add_all("MusicVideo", all_mvideos, view) else: @@ -473,6 +485,10 @@ class LibrarySync(threading.Thread): tvshows.count = 0 for all_tvshows in mb.get_items(view['id'], "Series"): + + if should_stop(): + return False + tvshows.add_all("Series", all_tvshows, view) else: @@ -497,6 +513,10 @@ class LibrarySync(threading.Thread): music.count = 0 for all_artists in mb.get_artists(view['id']): + + if should_stop(): + return False + music.add_all("MusicArtist", all_artists) log.debug("Finished syncing music") @@ -750,6 +770,7 @@ class LibrarySync(threading.Thread): # Only try the initial sync once per kodi session regardless # This will prevent an infinite loop in case something goes wrong. startupComplete = True + window('emby.connected', value="true") # Process updates if self.incremental_count > 5: diff --git a/resources/lib/service_entry.py b/resources/lib/service_entry.py index e4c24674..a20f8698 100644 --- a/resources/lib/service_entry.py +++ b/resources/lib/service_entry.py @@ -76,7 +76,7 @@ class Service(object): "emby_syncRunning", "emby_dbCheck", "emby_kodiScan", "emby_shouldStop", "emby_currUser", "emby_dbScan", "emby_sessionId", "emby_initialScan", "emby_customplaylist", "emby_playbackProps", - "emby.external_check", "emby.external", "emby.resume" + "emby.external_check", "emby.external", "emby.resume", "emby.connected" ] for prop in properties: window(prop, clear=True)