From da4b99f98962cdcb19aa16556a5dd28623311b27 Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Tue, 12 May 2015 21:27:27 +0200 Subject: [PATCH] more fancy solution for the episode adds where show doesn't exist yet --- resources/lib/LibrarySync.py | 16 ++++++++++------ resources/lib/WebSocketClient.py | 8 ++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/resources/lib/LibrarySync.py b/resources/lib/LibrarySync.py index 2f6931e1..89b6cd91 100644 --- a/resources/lib/LibrarySync.py +++ b/resources/lib/LibrarySync.py @@ -70,9 +70,8 @@ class LibrarySync(): cursor = connection.cursor() #Add the special emby table - if not startupDone: - cursor.execute("CREATE TABLE IF NOT EXISTS emby(emby_id TEXT, kodi_id INTEGER, media_type TEXT, checksum TEXT, parent_id INTEGER)") - connection.commit() + cursor.execute("CREATE TABLE IF NOT EXISTS emby(emby_id TEXT, kodi_id INTEGER, media_type TEXT, checksum TEXT, parent_id INTEGER)") + connection.commit() # sync movies self.MoviesFullSync(connection,cursor,pDialog) @@ -99,9 +98,8 @@ class LibrarySync(): cursor = connection.cursor() #Add the special emby table - if not startupDone: - cursor.execute("CREATE TABLE IF NOT EXISTS emby(emby_id TEXT, kodi_id INTEGER, media_type TEXT, checksum TEXT, parent_id INTEGER)") - connection.commit() + cursor.execute("CREATE TABLE IF NOT EXISTS emby(emby_id TEXT, kodi_id INTEGER, media_type TEXT, checksum TEXT, parent_id INTEGER)") + connection.commit() self.MusicFullSync(connection,cursor,pDialog) cursor.close() @@ -575,6 +573,12 @@ class LibrarySync(): if kodi_show_id: WriteKodiVideoDB().addOrUpdateEpisodeToKodiLibrary(MBitem["Id"], kodi_show_id, connection, cursor) + else: + #tv show doesn't exist + #perform full tvshow sync instead so both the show and episodes get added + self.TvShowsFullSync(connection,cursor,None) + return + #### PROCESS MUSICVIDEOS #### allEmbyMusicvideos = ReadEmbyDB().getMusicVideos(itemList) diff --git a/resources/lib/WebSocketClient.py b/resources/lib/WebSocketClient.py index f89a53f4..a1c52d2a 100644 --- a/resources/lib/WebSocketClient.py +++ b/resources/lib/WebSocketClient.py @@ -163,12 +163,8 @@ class WebSocketThread(threading.Thread): self.logMsg("Message : WebSocket LibraryChanged : Items Updated : " + str(itemsUpdated), 0) self.logMsg("Message : WebSocket LibraryChanged : Items Removed : " + str(itemsRemoved), 0) - if itemsAdded: - self.logMsg("Message : Doing Full LibrarySync") - LibrarySync().FullLibrarySync() - else: - self.remove_items(itemsRemoved) - self.update_items(itemsToUpdate) + self.remove_items(itemsRemoved) + self.update_items(itemsToUpdate) elif messageType == "GeneralCommand":