mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
add some sleeps :-(
This commit is contained in:
parent
9c98f713e7
commit
47e3d6cb19
1 changed files with 30 additions and 21 deletions
|
@ -29,6 +29,9 @@ dataPath = os.path.join(addondir,"library")
|
||||||
movieLibrary = os.path.join(dataPath,'movies')
|
movieLibrary = os.path.join(dataPath,'movies')
|
||||||
tvLibrary = os.path.join(dataPath,'tvshows')
|
tvLibrary = os.path.join(dataPath,'tvshows')
|
||||||
|
|
||||||
|
sleepVal = 10
|
||||||
|
showProgress = True
|
||||||
|
|
||||||
class LibrarySync():
|
class LibrarySync():
|
||||||
|
|
||||||
def syncDatabase(self):
|
def syncDatabase(self):
|
||||||
|
@ -39,6 +42,7 @@ class LibrarySync():
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
|
if(showProgress):
|
||||||
pDialog = xbmcgui.DialogProgressBG()
|
pDialog = xbmcgui.DialogProgressBG()
|
||||||
if(pDialog != None):
|
if(pDialog != None):
|
||||||
pDialog.create('Sync DB', 'Sync DB')
|
pDialog.create('Sync DB', 'Sync DB')
|
||||||
|
@ -50,7 +54,7 @@ class LibrarySync():
|
||||||
movieData = self.getMovies(True)
|
movieData = self.getMovies(True)
|
||||||
|
|
||||||
if(self.ShouldStop()):
|
if(self.ShouldStop()):
|
||||||
return False
|
return True
|
||||||
|
|
||||||
if(movieData == None):
|
if(movieData == None):
|
||||||
return False
|
return False
|
||||||
|
@ -62,6 +66,7 @@ class LibrarySync():
|
||||||
|
|
||||||
for item in movieData:
|
for item in movieData:
|
||||||
if not item.get('IsFolder'):
|
if not item.get('IsFolder'):
|
||||||
|
xbmc.sleep(sleepVal)
|
||||||
kodiItem = self.getKodiMovie(item["Id"])
|
kodiItem = self.getKodiMovie(item["Id"])
|
||||||
allMovies.append(item["Id"])
|
allMovies.append(item["Id"])
|
||||||
progMessage = "Processing"
|
progMessage = "Processing"
|
||||||
|
@ -74,7 +79,7 @@ class LibrarySync():
|
||||||
progMessage = "Updating"
|
progMessage = "Updating"
|
||||||
|
|
||||||
if(self.ShouldStop()):
|
if(self.ShouldStop()):
|
||||||
return False
|
return True
|
||||||
|
|
||||||
# update progress bar
|
# update progress bar
|
||||||
if(pDialog != None):
|
if(pDialog != None):
|
||||||
|
@ -88,7 +93,7 @@ class LibrarySync():
|
||||||
tvShowData = self.getTVShows(True)
|
tvShowData = self.getTVShows(True)
|
||||||
|
|
||||||
if(self.ShouldStop()):
|
if(self.ShouldStop()):
|
||||||
return False
|
return True
|
||||||
|
|
||||||
if (tvShowData == None):
|
if (tvShowData == None):
|
||||||
return
|
return
|
||||||
|
@ -100,6 +105,7 @@ class LibrarySync():
|
||||||
|
|
||||||
for item in tvShowData:
|
for item in tvShowData:
|
||||||
if item.get('IsFolder'):
|
if item.get('IsFolder'):
|
||||||
|
xbmc.sleep(sleepVal)
|
||||||
kodiItem = self.getKodiTVShow(item["Id"])
|
kodiItem = self.getKodiTVShow(item["Id"])
|
||||||
allTVShows.append(item["Id"])
|
allTVShows.append(item["Id"])
|
||||||
progMessage = "Processing"
|
progMessage = "Processing"
|
||||||
|
@ -112,7 +118,7 @@ class LibrarySync():
|
||||||
progMessage = "Updating"
|
progMessage = "Updating"
|
||||||
|
|
||||||
if(self.ShouldStop()):
|
if(self.ShouldStop()):
|
||||||
return False
|
return True
|
||||||
|
|
||||||
# update progress bar
|
# update progress bar
|
||||||
if(pDialog != None):
|
if(pDialog != None):
|
||||||
|
@ -131,7 +137,7 @@ class LibrarySync():
|
||||||
kodiEpisodes = self.getKodiEpisodes(tvshow)
|
kodiEpisodes = self.getKodiEpisodes(tvshow)
|
||||||
|
|
||||||
if(self.ShouldStop()):
|
if(self.ShouldStop()):
|
||||||
return False
|
return True
|
||||||
|
|
||||||
if(pDialog != None):
|
if(pDialog != None):
|
||||||
pDialog.update(0, "Sync DB : Processing Episodes")
|
pDialog.update(0, "Sync DB : Processing Episodes")
|
||||||
|
@ -140,6 +146,7 @@ class LibrarySync():
|
||||||
|
|
||||||
#we have to compare the lists somehow
|
#we have to compare the lists somehow
|
||||||
for item in episodeData:
|
for item in episodeData:
|
||||||
|
xbmc.sleep(sleepVal)
|
||||||
comparestring1 = str(item.get("ParentIndexNumber")) + "-" + str(item.get("IndexNumber"))
|
comparestring1 = str(item.get("ParentIndexNumber")) + "-" + str(item.get("IndexNumber"))
|
||||||
matchFound = False
|
matchFound = False
|
||||||
progMessage = "Processing"
|
progMessage = "Processing"
|
||||||
|
@ -162,7 +169,7 @@ class LibrarySync():
|
||||||
progMessage = "Adding"
|
progMessage = "Adding"
|
||||||
|
|
||||||
if(self.ShouldStop()):
|
if(self.ShouldStop()):
|
||||||
return False
|
return True
|
||||||
|
|
||||||
# update progress bar
|
# update progress bar
|
||||||
if(pDialog != None):
|
if(pDialog != None):
|
||||||
|
@ -176,7 +183,7 @@ class LibrarySync():
|
||||||
pDialog.update(0, message="Removing Deleted Items")
|
pDialog.update(0, message="Removing Deleted Items")
|
||||||
|
|
||||||
if(self.ShouldStop()):
|
if(self.ShouldStop()):
|
||||||
return False
|
return True
|
||||||
|
|
||||||
cleanNeeded = False
|
cleanNeeded = False
|
||||||
allLocaldirs, filesMovies = xbmcvfs.listdir(movieLibrary)
|
allLocaldirs, filesMovies = xbmcvfs.listdir(movieLibrary)
|
||||||
|
@ -187,7 +194,7 @@ class LibrarySync():
|
||||||
cleanneeded = True
|
cleanneeded = True
|
||||||
|
|
||||||
if(self.ShouldStop()):
|
if(self.ShouldStop()):
|
||||||
return False
|
return True
|
||||||
|
|
||||||
allLocaldirs, filesTVShows = xbmcvfs.listdir(tvLibrary)
|
allLocaldirs, filesTVShows = xbmcvfs.listdir(tvLibrary)
|
||||||
allMB3TVShows = set(allTVShows)
|
allMB3TVShows = set(allTVShows)
|
||||||
|
@ -197,7 +204,7 @@ class LibrarySync():
|
||||||
cleanneeded = True
|
cleanneeded = True
|
||||||
|
|
||||||
if(self.ShouldStop()):
|
if(self.ShouldStop()):
|
||||||
return False
|
return True
|
||||||
|
|
||||||
if cleanNeeded:
|
if cleanNeeded:
|
||||||
WINDOW.setProperty("cleanNeeded", "true")
|
WINDOW.setProperty("cleanNeeded", "true")
|
||||||
|
@ -220,7 +227,7 @@ class LibrarySync():
|
||||||
pDialog = None
|
pDialog = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
if(showProgress):
|
||||||
pDialog = xbmcgui.DialogProgressBG()
|
pDialog = xbmcgui.DialogProgressBG()
|
||||||
if(pDialog != None):
|
if(pDialog != None):
|
||||||
pDialog.create('Sync PlayCounts', 'Sync PlayCounts')
|
pDialog.create('Sync PlayCounts', 'Sync PlayCounts')
|
||||||
|
@ -229,7 +236,7 @@ class LibrarySync():
|
||||||
movieData = self.getMovies(False)
|
movieData = self.getMovies(False)
|
||||||
|
|
||||||
if(self.ShouldStop()):
|
if(self.ShouldStop()):
|
||||||
return False
|
return True
|
||||||
|
|
||||||
if(movieData == None):
|
if(movieData == None):
|
||||||
return False
|
return False
|
||||||
|
@ -241,6 +248,7 @@ class LibrarySync():
|
||||||
|
|
||||||
for item in movieData:
|
for item in movieData:
|
||||||
if not item.get('IsFolder'):
|
if not item.get('IsFolder'):
|
||||||
|
xbmc.sleep(sleepVal)
|
||||||
kodiItem = self.getKodiMovie(item["Id"])
|
kodiItem = self.getKodiMovie(item["Id"])
|
||||||
userData=API().getUserData(item)
|
userData=API().getUserData(item)
|
||||||
timeInfo = API().getTimeInfo(item)
|
timeInfo = API().getTimeInfo(item)
|
||||||
|
@ -255,7 +263,7 @@ class LibrarySync():
|
||||||
self.setKodiResumePoint(kodiItem['movieid'],resume,total,"movie")
|
self.setKodiResumePoint(kodiItem['movieid'],resume,total,"movie")
|
||||||
|
|
||||||
if(self.ShouldStop()):
|
if(self.ShouldStop()):
|
||||||
return False
|
return True
|
||||||
|
|
||||||
# update progress bar
|
# update progress bar
|
||||||
if(pDialog != None):
|
if(pDialog != None):
|
||||||
|
@ -267,21 +275,22 @@ class LibrarySync():
|
||||||
tvshowData = self.getTVShows(False)
|
tvshowData = self.getTVShows(False)
|
||||||
|
|
||||||
if(self.ShouldStop()):
|
if(self.ShouldStop()):
|
||||||
return False
|
return True
|
||||||
|
|
||||||
if (tvshowData == None):
|
if (tvshowData == None):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if(pDialog != None):
|
|
||||||
pDialog.update(0, "Sync PlayCounts: Processing Episodes")
|
|
||||||
totalCount = len(movieData) + 1
|
|
||||||
count = 1
|
|
||||||
|
|
||||||
for item in tvshowData:
|
for item in tvshowData:
|
||||||
episodeData = self.getEpisodes(item["Id"], False)
|
episodeData = self.getEpisodes(item["Id"], False)
|
||||||
|
|
||||||
if (episodeData != None):
|
if (episodeData != None):
|
||||||
|
if(pDialog != None):
|
||||||
|
pDialog.update(0, "Sync PlayCounts: Processing Episodes")
|
||||||
|
totalCount = len(episodeData) + 1
|
||||||
|
count = 1
|
||||||
|
|
||||||
for episode in episodeData:
|
for episode in episodeData:
|
||||||
|
xbmc.sleep(sleepVal)
|
||||||
kodiItem = self.getKodiEpisodeByMbItem(episode)
|
kodiItem = self.getKodiEpisodeByMbItem(episode)
|
||||||
userData=API().getUserData(episode)
|
userData=API().getUserData(episode)
|
||||||
timeInfo = API().getTimeInfo(episode)
|
timeInfo = API().getTimeInfo(episode)
|
||||||
|
@ -296,7 +305,7 @@ class LibrarySync():
|
||||||
self.setKodiResumePoint(kodiItem['episodeid'],resume,total,"episode")
|
self.setKodiResumePoint(kodiItem['episodeid'],resume,total,"episode")
|
||||||
|
|
||||||
if(self.ShouldStop()):
|
if(self.ShouldStop()):
|
||||||
return False
|
return True
|
||||||
|
|
||||||
# update progress bar
|
# update progress bar
|
||||||
if(pDialog != None):
|
if(pDialog != None):
|
||||||
|
|
Loading…
Reference in a new issue