mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-26 02:36:10 +00:00
optimize playcount sync for Movies
replaced call per-item by 1 single call to Kodi api
This commit is contained in:
parent
43b8cd781d
commit
5ec6afaf99
1 changed files with 13 additions and 3 deletions
|
@ -541,6 +541,7 @@ class LibrarySync():
|
||||||
viewCurrent = 1
|
viewCurrent = 1
|
||||||
for view in views:
|
for view in views:
|
||||||
allMB3Movies = ReadEmbyDB().getMovies(view.get('id'),False)
|
allMB3Movies = ReadEmbyDB().getMovies(view.get('id'),False)
|
||||||
|
allKodiMovies = ReadKodiDB().getKodiMovies(False)
|
||||||
|
|
||||||
if(self.ShouldStop()):
|
if(self.ShouldStop()):
|
||||||
return True
|
return True
|
||||||
|
@ -548,6 +549,9 @@ class LibrarySync():
|
||||||
if(allMB3Movies == None):
|
if(allMB3Movies == None):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
if(allKodiMovies == None):
|
||||||
|
return False
|
||||||
|
|
||||||
if(pDialog != None):
|
if(pDialog != None):
|
||||||
pDialog.update(0, "Sync PlayCounts: Processing " + view.get('title') + " " + str(viewCurrent) + " of " + str(viewCount))
|
pDialog.update(0, "Sync PlayCounts: Processing " + view.get('title') + " " + str(viewCurrent) + " of " + str(viewCount))
|
||||||
totalCount = len(allMB3Movies) + 1
|
totalCount = len(allMB3Movies) + 1
|
||||||
|
@ -556,7 +560,13 @@ class LibrarySync():
|
||||||
for item in allMB3Movies:
|
for item in allMB3Movies:
|
||||||
xbmc.sleep(sleepVal)
|
xbmc.sleep(sleepVal)
|
||||||
if not item.get('IsFolder'):
|
if not item.get('IsFolder'):
|
||||||
kodiItem = ReadKodiDB().getKodiMovie(item["Id"])
|
|
||||||
|
kodiItem = None
|
||||||
|
for kodimovie in allKodiMovies:
|
||||||
|
if item["Id"] in kodimovie["file"]:
|
||||||
|
kodiItem = kodimovie
|
||||||
|
break
|
||||||
|
|
||||||
userData=API().getUserData(item)
|
userData=API().getUserData(item)
|
||||||
timeInfo = API().getTimeInfo(item)
|
timeInfo = API().getTimeInfo(item)
|
||||||
if kodiItem != None:
|
if kodiItem != None:
|
||||||
|
|
Loading…
Reference in a new issue