Use the Emby ID as the key to look up Episodes

This commit is contained in:
shaun 2015-04-17 22:26:28 +10:00
parent 2112ab951b
commit 11218b7891
2 changed files with 4 additions and 10 deletions

View file

@ -382,11 +382,8 @@ class LibrarySync():
userData = API().getUserData(episode)
WINDOW.setProperty("EmbyUserKey" + userData.get("Key"), episode.get('Id') + ";;" + episode.get("Type"))
#we have to compare the lists somehow
comparestring1 = str(episode.get("ParentIndexNumber")) + "-" + str(episode.get("IndexNumber"))
if kodiEpisodes != None:
KodiItem = kodiEpisodes.get(comparestring1, None)
KodiItem = kodiEpisodes.get(episode.get("Id"), None)
if(KodiItem != None):
WriteKodiDB().updateEpisodeToKodiLibrary(episode, KodiItem, connection, cursor)
@ -531,14 +528,13 @@ class LibrarySync():
#add episodeId to the list of all episodes for use later on the deletes
allMB3EpisodeIds.append(item["Id"])
comparestring1 = str(item.get("ParentIndexNumber")) + "-" + str(item.get("IndexNumber"))
matchFound = False
userData = API().getUserData(item)
WINDOW.setProperty("EmbyUserKey" + userData.get("Key"), item.get('Id') + ";;" + item.get("Type"))
if kodiEpisodes != None:
KodiItem = kodiEpisodes.get(comparestring1, None)
KodiItem = kodiEpisodes.get(item.get("Id"), None)
if(KodiItem != None):
updated = WriteKodiDB().updateEpisodeToKodiLibrary(item, KodiItem, connection, cursor)
if(updated):
@ -863,10 +859,9 @@ class LibrarySync():
for episode in episodeData:
kodiItem = None
comparestring1 = str(episode.get("ParentIndexNumber")) + "-" + str(episode.get("IndexNumber"))
matchFound = False
if kodiEpisodes != None:
kodiItem = kodiEpisodes.get(comparestring1, None)
kodiItem = kodiEpisodes.get(episode.get("Id"), None)
userData=API().getUserData(episode)
timeInfo = API().getTimeInfo(episode)

View file

@ -189,8 +189,7 @@ class ReadKodiDB():
if(episodes != None):
episodeMap = {}
for KodiItem in episodes:
key = str(KodiItem["season"]) + "-" + str(KodiItem["episode"])
episodeMap[key] = KodiItem
episodeMap[KodiItem["uniqueid"]["unknown"]] = KodiItem
return episodeMap
else:
return episodes