mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
small changes
This commit is contained in:
parent
62b3f8da2d
commit
53fb4a9207
1 changed files with 85 additions and 82 deletions
|
@ -218,93 +218,96 @@ class LibrarySync():
|
||||||
|
|
||||||
# incremental sync --> new episodes only
|
# incremental sync --> new episodes only
|
||||||
if not fullsync:
|
if not fullsync:
|
||||||
|
|
||||||
latestMBEpisodes = ReadEmbyDB().getLatestEpisodes(True)
|
latestMBEpisodes = ReadEmbyDB().getLatestEpisodes(True)
|
||||||
allKodiTvShowsIds = set(ReadKodiDB().getKodiTvShowsIds(True))
|
|
||||||
|
|
||||||
updateNeeded = False
|
if latestMBEpisodes != None:
|
||||||
|
allKodiTvShowsIds = set(ReadKodiDB().getKodiTvShowsIds(True))
|
||||||
# process new episodes
|
|
||||||
for tvshow in latestMBEpisodes:
|
|
||||||
if tvshow["SeriesId"] in allKodiTvShowsIds:
|
|
||||||
#only process tvshows that already exist in the db at incremental updates
|
|
||||||
kodiEpisodes = ReadKodiDB().getKodiEpisodes(tvshow["SeriesId"])
|
|
||||||
|
|
||||||
if(self.ShouldStop()):
|
|
||||||
return True
|
|
||||||
|
|
||||||
if(pDialog != None):
|
|
||||||
pDialog.update(0, "Sync DB : Processing Episodes")
|
|
||||||
total = len(latestMBEpisodes) + 1
|
|
||||||
count = 0
|
|
||||||
|
|
||||||
#we have to compare the lists somehow
|
|
||||||
xbmc.sleep(sleepVal)
|
|
||||||
comparestring1 = str(tvshow.get("ParentIndexNumber")) + "-" + str(tvshow.get("IndexNumber"))
|
|
||||||
matchFound = False
|
|
||||||
progMessage = "Processing"
|
|
||||||
if kodiEpisodes != None:
|
|
||||||
for KodiItem in kodiEpisodes:
|
|
||||||
|
|
||||||
comparestring2 = str(KodiItem["season"]) + "-" + str(KodiItem["episode"])
|
|
||||||
if comparestring1 == comparestring2:
|
|
||||||
matchFound = True
|
|
||||||
|
|
||||||
if not matchFound:
|
|
||||||
#no match so we have to create it
|
|
||||||
WriteKodiDB().addEpisodeToKodiLibrary(tvshow,tvshow)
|
|
||||||
updateNeeded = True
|
|
||||||
progMessage = "Adding"
|
|
||||||
|
|
||||||
if(self.ShouldStop()):
|
|
||||||
return True
|
|
||||||
|
|
||||||
# update progress bar
|
|
||||||
if(pDialog != None):
|
|
||||||
percentage = int(((float(count) / float(total)) * 100))
|
|
||||||
pDialog.update(percentage, message=progMessage + " Episode: " + str(count))
|
|
||||||
count += 1
|
|
||||||
|
|
||||||
#initiate library update and wait for finish before processing any updates
|
|
||||||
if updateNeeded:
|
|
||||||
self.doKodiLibraryUpdate()
|
|
||||||
updateNeeded = False
|
updateNeeded = False
|
||||||
|
|
||||||
#process updates
|
# process new episodes
|
||||||
for tvshow in latestMBEpisodes:
|
for tvshow in latestMBEpisodes:
|
||||||
if tvshow["SeriesId"] in allKodiTvShowsIds:
|
if tvshow["SeriesId"] in allKodiTvShowsIds:
|
||||||
#only process tvshows that already exist in the db at incremental updates
|
#only process tvshows that already exist in the db at incremental updates
|
||||||
kodiEpisodes = ReadKodiDB().getKodiEpisodes(tvshow["SeriesId"])
|
kodiEpisodes = ReadKodiDB().getKodiEpisodes(tvshow["SeriesId"])
|
||||||
|
|
||||||
if(self.ShouldStop()):
|
|
||||||
return True
|
|
||||||
|
|
||||||
if(pDialog != None):
|
|
||||||
pDialog.update(0, "Sync DB : Processing Episodes")
|
|
||||||
total = len(latestMBEpisodes) + 1
|
|
||||||
count = 0
|
|
||||||
|
|
||||||
#we have to compare the lists somehow
|
|
||||||
xbmc.sleep(sleepVal)
|
|
||||||
comparestring1 = str(tvshow.get("ParentIndexNumber")) + "-" + str(tvshow.get("IndexNumber"))
|
|
||||||
progMessage = "Processing"
|
|
||||||
if kodiEpisodes != None:
|
|
||||||
for KodiItem in kodiEpisodes:
|
|
||||||
comparestring2 = str(KodiItem["season"]) + "-" + str(KodiItem["episode"])
|
|
||||||
if comparestring1 == comparestring2:
|
|
||||||
#match found - update episode
|
|
||||||
|
|
||||||
progMessage = "Updating"
|
|
||||||
|
|
||||||
if(self.ShouldStop()):
|
if(self.ShouldStop()):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
if(pDialog != None):
|
||||||
|
pDialog.update(0, "Sync DB : Processing Episodes")
|
||||||
|
total = len(latestMBEpisodes) + 1
|
||||||
|
count = 0
|
||||||
|
|
||||||
# update progress bar
|
#we have to compare the lists somehow
|
||||||
if(pDialog != None):
|
xbmc.sleep(sleepVal)
|
||||||
percentage = int(((float(count) / float(total)) * 100))
|
comparestring1 = str(tvshow.get("ParentIndexNumber")) + "-" + str(tvshow.get("IndexNumber"))
|
||||||
pDialog.update(percentage, message=progMessage + " Episode: " + str(count))
|
matchFound = False
|
||||||
count += 1
|
progMessage = "Processing"
|
||||||
|
if kodiEpisodes != None:
|
||||||
|
for KodiItem in kodiEpisodes:
|
||||||
|
|
||||||
|
comparestring2 = str(KodiItem["season"]) + "-" + str(KodiItem["episode"])
|
||||||
|
if comparestring1 == comparestring2:
|
||||||
|
matchFound = True
|
||||||
|
|
||||||
|
if not matchFound:
|
||||||
|
#no match so we have to create it
|
||||||
|
WriteKodiDB().addEpisodeToKodiLibrary(tvshow,tvshow)
|
||||||
|
updateNeeded = True
|
||||||
|
progMessage = "Adding"
|
||||||
|
|
||||||
|
if(self.ShouldStop()):
|
||||||
|
return True
|
||||||
|
|
||||||
|
# update progress bar
|
||||||
|
if(pDialog != None):
|
||||||
|
percentage = int(((float(count) / float(total)) * 100))
|
||||||
|
pDialog.update(percentage, message=progMessage + " Episode: " + str(count))
|
||||||
|
count += 1
|
||||||
|
|
||||||
|
#initiate library update and wait for finish before processing any updates
|
||||||
|
if updateNeeded:
|
||||||
|
self.doKodiLibraryUpdate()
|
||||||
|
updateNeeded = False
|
||||||
|
|
||||||
|
#process updates
|
||||||
|
for tvshow in latestMBEpisodes:
|
||||||
|
if tvshow["SeriesId"] in allKodiTvShowsIds:
|
||||||
|
#only process tvshows that already exist in the db at incremental updates
|
||||||
|
kodiEpisodes = ReadKodiDB().getKodiEpisodes(tvshow["SeriesId"])
|
||||||
|
|
||||||
|
if(self.ShouldStop()):
|
||||||
|
return True
|
||||||
|
|
||||||
|
if(pDialog != None):
|
||||||
|
pDialog.update(0, "Sync DB : Processing Episodes")
|
||||||
|
total = len(latestMBEpisodes) + 1
|
||||||
|
count = 0
|
||||||
|
|
||||||
|
#we have to compare the lists somehow
|
||||||
|
xbmc.sleep(sleepVal)
|
||||||
|
comparestring1 = str(tvshow.get("ParentIndexNumber")) + "-" + str(tvshow.get("IndexNumber"))
|
||||||
|
progMessage = "Processing"
|
||||||
|
if kodiEpisodes != None:
|
||||||
|
for KodiItem in kodiEpisodes:
|
||||||
|
comparestring2 = str(KodiItem["season"]) + "-" + str(KodiItem["episode"])
|
||||||
|
if comparestring1 == comparestring2:
|
||||||
|
#match found - update episode
|
||||||
|
|
||||||
|
progMessage = "Updating"
|
||||||
|
|
||||||
|
if(self.ShouldStop()):
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
# update progress bar
|
||||||
|
if(pDialog != None):
|
||||||
|
percentage = int(((float(count) / float(total)) * 100))
|
||||||
|
pDialog.update(percentage, message=progMessage + " Episode: " + str(count))
|
||||||
|
count += 1
|
||||||
|
|
||||||
|
|
||||||
# full sync --> Tv shows and Episodes
|
# full sync --> Tv shows and Episodes
|
||||||
if fullsync:
|
if fullsync:
|
||||||
|
|
Loading…
Reference in a new issue