Fix episode tags, unspecified collection types

This commit is contained in:
xnappo 2015-04-05 08:55:41 -05:00
parent 65b6411fb3
commit f46b67209c
2 changed files with 19 additions and 19 deletions

View file

@ -290,6 +290,7 @@ class LibrarySync():
totalItemsDeleted = 0 totalItemsDeleted = 0
allTVShows = list() allTVShows = list()
allMB3EpisodeIds = list() #for use with deletions allMB3EpisodeIds = list() #for use with deletions
allKodiEpisodeIds = [] # for use with deletions
views = ReadEmbyDB().getCollections("tvshows") views = ReadEmbyDB().getCollections("tvshows")
viewCount = len(views) viewCount = len(views)
@ -373,7 +374,6 @@ class LibrarySync():
# full sync --> Tv shows and Episodes # full sync --> Tv shows and Episodes
if fullsync: if fullsync:
allKodiEpisodeIds = [] # for use with deletions
viewTVShows = list() viewTVShows = list()
tvShowData = ReadEmbyDB().getTVShows(id = view.get('id') , fullinfo = True, fullSync = True) tvShowData = ReadEmbyDB().getTVShows(id = view.get('id') , fullinfo = True, fullSync = True)
allKodiIds = set(ReadKodiDB().getKodiTvShowsIds(True)) allKodiIds = set(ReadKodiDB().getKodiTvShowsIds(True))
@ -546,23 +546,23 @@ class LibrarySync():
if(self.ShouldStop(pDialog)): if(self.ShouldStop(pDialog)):
return False return False
# DELETES -- EPISODES # DELETES -- EPISODES
# process any deletes only at fullsync # process any deletes only at fullsync
allMB3EpisodeIdsSet = set(allMB3EpisodeIds) allMB3EpisodeIdsSet = set(allMB3EpisodeIds)
for episode in allKodiEpisodeIds: for episode in allKodiEpisodeIds:
if episode.get('episodeid') not in allMB3EpisodeIdsSet: if episode.get('episodeid') not in allMB3EpisodeIdsSet:
WINDOW.setProperty("embyid" + str(episode.get('episodeid')),"deleted") WINDOW.setProperty("embyid" + str(episode.get('episodeid')),"deleted")
WriteKodiDB().deleteEpisodeFromKodiLibrary(episode.get('episodeid'),episode.get('tvshowid')) WriteKodiDB().deleteEpisodeFromKodiLibrary(episode.get('episodeid'),episode.get('tvshowid'))
totalItemsDeleted += 1 totalItemsDeleted += 1
# DELETES -- TV SHOWS # DELETES -- TV SHOWS
if fullsync: if fullsync:
allKodiShows = ReadKodiDB().getKodiTvShowsIds(True) allKodiShows = ReadKodiDB().getKodiTvShowsIds(True)
allMB3TVShows = set(allTVShows) allMB3TVShows = set(allTVShows)
for show in allKodiShows: for show in allKodiShows:
if not show in allMB3TVShows: if not show in allMB3TVShows:
WriteKodiDB().deleteTVShowFromKodiLibrary(show) WriteKodiDB().deleteTVShowFromKodiLibrary(show)
totalItemsDeleted += 1 totalItemsDeleted += 1
if(self.ShouldStop(pDialog)): if(self.ShouldStop(pDialog)):
return False return False

View file

@ -258,8 +258,8 @@ class ReadEmbyDB():
Name = Temp.encode('utf-8') Name = Temp.encode('utf-8')
section = item.get("CollectionType") section = item.get("CollectionType")
itemtype = item.get("CollectionType") itemtype = item.get("CollectionType")
if itemtype == None: if itemtype == None or itemtype == "":
itemtype = "None" # User may not have declared the type itemtype = "movies" # User may not have declared the type
if itemtype == type and item.get("Name") != "Collections": if itemtype == type and item.get("Name") != "Collections":
collections.append( {'title' : item.get("Name"), collections.append( {'title' : item.get("Name"),
'type' : itemtype, 'type' : itemtype,