From f46b67209caf4e3de076b6ec399369567206d7a0 Mon Sep 17 00:00:00 2001 From: xnappo Date: Sun, 5 Apr 2015 08:55:41 -0500 Subject: [PATCH] Fix episode tags, unspecified collection types --- resources/lib/LibrarySync.py | 34 +++++++++++++++++----------------- resources/lib/ReadEmbyDB.py | 4 ++-- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/resources/lib/LibrarySync.py b/resources/lib/LibrarySync.py index 13babb15..d07179dc 100644 --- a/resources/lib/LibrarySync.py +++ b/resources/lib/LibrarySync.py @@ -290,6 +290,7 @@ class LibrarySync(): totalItemsDeleted = 0 allTVShows = list() allMB3EpisodeIds = list() #for use with deletions + allKodiEpisodeIds = [] # for use with deletions views = ReadEmbyDB().getCollections("tvshows") viewCount = len(views) @@ -373,7 +374,6 @@ class LibrarySync(): # full sync --> Tv shows and Episodes if fullsync: - allKodiEpisodeIds = [] # for use with deletions viewTVShows = list() tvShowData = ReadEmbyDB().getTVShows(id = view.get('id') , fullinfo = True, fullSync = True) allKodiIds = set(ReadKodiDB().getKodiTvShowsIds(True)) @@ -546,23 +546,23 @@ class LibrarySync(): if(self.ShouldStop(pDialog)): return False - # DELETES -- EPISODES - # process any deletes only at fullsync - allMB3EpisodeIdsSet = set(allMB3EpisodeIds) - for episode in allKodiEpisodeIds: - if episode.get('episodeid') not in allMB3EpisodeIdsSet: - WINDOW.setProperty("embyid" + str(episode.get('episodeid')),"deleted") - WriteKodiDB().deleteEpisodeFromKodiLibrary(episode.get('episodeid'),episode.get('tvshowid')) + # DELETES -- EPISODES + # process any deletes only at fullsync + allMB3EpisodeIdsSet = set(allMB3EpisodeIds) + for episode in allKodiEpisodeIds: + if episode.get('episodeid') not in allMB3EpisodeIdsSet: + WINDOW.setProperty("embyid" + str(episode.get('episodeid')),"deleted") + WriteKodiDB().deleteEpisodeFromKodiLibrary(episode.get('episodeid'),episode.get('tvshowid')) + totalItemsDeleted += 1 + + # DELETES -- TV SHOWS + if fullsync: + allKodiShows = ReadKodiDB().getKodiTvShowsIds(True) + allMB3TVShows = set(allTVShows) + for show in allKodiShows: + if not show in allMB3TVShows: + WriteKodiDB().deleteTVShowFromKodiLibrary(show) totalItemsDeleted += 1 - - # DELETES -- TV SHOWS - if fullsync: - allKodiShows = ReadKodiDB().getKodiTvShowsIds(True) - allMB3TVShows = set(allTVShows) - for show in allKodiShows: - if not show in allMB3TVShows: - WriteKodiDB().deleteTVShowFromKodiLibrary(show) - totalItemsDeleted += 1 if(self.ShouldStop(pDialog)): return False diff --git a/resources/lib/ReadEmbyDB.py b/resources/lib/ReadEmbyDB.py index 45884d02..f7c7626d 100644 --- a/resources/lib/ReadEmbyDB.py +++ b/resources/lib/ReadEmbyDB.py @@ -258,8 +258,8 @@ class ReadEmbyDB(): Name = Temp.encode('utf-8') section = item.get("CollectionType") itemtype = item.get("CollectionType") - if itemtype == None: - itemtype = "None" # User may not have declared the type + if itemtype == None or itemtype == "": + itemtype = "movies" # User may not have declared the type if itemtype == type and item.get("Name") != "Collections": collections.append( {'title' : item.get("Name"), 'type' : itemtype,