On first sync show a regular Progress Dialog

This commit is contained in:
faush01 2015-03-20 19:15:06 +11:00
parent 5dd145a8e8
commit cbfc40f430

View file

@ -77,11 +77,12 @@ class LibrarySync():
enableProgress = False enableProgress = False
if addon.getSetting("enableProgressFullSync") == 'true': if addon.getSetting("enableProgressFullSync") == 'true':
enableProgress = True enableProgress = True
startupStr = WINDOW.getProperty("startup")
if startupStr != "done": if(addon.getSetting("SyncFirstMovieRunDone") != 'true'):
enableProgress = True pDialog = xbmcgui.DialogProgress()
if(enableProgress): elif(enableProgress):
pDialog = xbmcgui.DialogProgressBG() pDialog = xbmcgui.DialogProgressBG()
if(pDialog != None): if(pDialog != None):
pDialog.create('Sync DB', 'Sync DB') pDialog.create('Sync DB', 'Sync DB')
@ -90,6 +91,7 @@ class LibrarySync():
views = ReadEmbyDB().getCollections("movies") views = ReadEmbyDB().getCollections("movies")
viewCount = len(views) viewCount = len(views)
viewCurrent = 1 viewCurrent = 1
progressTitle = ""
for view in views: for view in views:
@ -99,14 +101,15 @@ class LibrarySync():
allMB3Movies = ReadEmbyDB().getMovies(view.get('id'), True, fullsync) allMB3Movies = ReadEmbyDB().getMovies(view.get('id'), True, fullsync)
allKodiIds = set(ReadKodiDB().getKodiMoviesIds(True)) allKodiIds = set(ReadKodiDB().getKodiMoviesIds(True))
if(self.ShouldStop()): if(self.ShouldStop(pDialog)):
return True return True
if(allMB3Movies == None): if(allMB3Movies == None):
return False return False
if(pDialog != None): if(pDialog != None):
pDialog.update(0, "Sync DB : Processing " + view.get('title') + " " + str(viewCurrent) + " of " + str(viewCount)) progressTitle = "Sync DB : Processing " + view.get('title') + " " + str(viewCurrent) + " of " + str(viewCount)
pDialog.update(0, progressTitle)
total = len(allMB3Movies) + 1 total = len(allMB3Movies) + 1
count = 1 count = 1
@ -121,33 +124,34 @@ class LibrarySync():
WriteKodiDB().addMovieToKodiLibrary(item) WriteKodiDB().addMovieToKodiLibrary(item)
updateNeeded = True updateNeeded = True
if(self.ShouldStop()): if(self.ShouldStop(pDialog)):
return True
if(self.ShouldStop()):
return True return True
# update progress bar # update progress bar
if(pDialog != None): if(pDialog != None):
percentage = int(((float(count) / float(total)) * 100)) percentage = int(((float(count) / float(total)) * 100))
pDialog.update(percentage, message = "Adding Movie: " + str(count)) pDialog.update(percentage, progressTitle, "Adding Movie: " + str(count))
count += 1 count += 1
#initiate library update and wait for finish before processing any updates #initiate library update and wait for finish before processing any updates
if updateNeeded: if updateNeeded:
if(pDialog != None): if(pDialog != None):
pDialog.update(0, "Processing Movie Updates", "Importing STRM Files")
if(pDialog != None and type(pDialog) == xbmcgui.DialogProgressBG):
pDialog.close() pDialog.close()
self.doKodiLibraryUpdate() self.doKodiLibraryUpdate(False, pDialog)
if(pDialog != None): if(pDialog != None and type(pDialog) == xbmcgui.DialogProgressBG):
pDialog.create('Sync DB', 'Sync DB') pDialog.create('Sync DB', 'Sync DB')
if(self.ShouldStop()): if(self.ShouldStop(pDialog)):
return True return True
if(pDialog != None): if(pDialog != None):
pDialog.update(0, "Sync DB : Processing " + view.get('title') + " " + str(viewCurrent) + " of " + str(viewCount)) progressTitle = "Sync DB : Processing " + view.get('title') + " " + str(viewCurrent) + " of " + str(viewCount)
pDialog.update(0, progressTitle, "")
total = len(allMB3Movies) + 1 total = len(allMB3Movies) + 1
count = 1 count = 1
@ -163,21 +167,22 @@ class LibrarySync():
if(kodimovie != None): if(kodimovie != None):
WriteKodiDB().updateMovieToKodiLibrary(item,kodimovie) WriteKodiDB().updateMovieToKodiLibrary(item,kodimovie)
if(self.ShouldStop()): if(self.ShouldStop(pDialog)):
return True return True
# update progress bar # update progress bar
if(pDialog != None): if(pDialog != None):
percentage = int(((float(count) / float(total)) * 100)) percentage = int(((float(count) / float(total)) * 100))
pDialog.update(percentage, message="Updating Movie: " + str(count)) pDialog.update(percentage, progressTitle, "Updating Movie: " + str(count))
count += 1 count += 1
viewCurrent += 1 viewCurrent += 1
if(pDialog != None): if(pDialog != None):
pDialog.update(0, message="Removing Deleted Items") progressTitle = "Removing Deleted Items"
pDialog.update(0, progressTitle, "")
if(self.ShouldStop()): if(self.ShouldStop(pDialog)):
return True return True
cleanNeeded = False cleanNeeded = False
@ -191,13 +196,15 @@ class LibrarySync():
WriteKodiDB().deleteMovieFromKodiLibrary(dir) WriteKodiDB().deleteMovieFromKodiLibrary(dir)
cleanNeeded = True cleanNeeded = True
if(self.ShouldStop()): if(self.ShouldStop(pDialog)):
return True return True
#initiate library clean and wait for finish before processing any updates #initiate library clean and wait for finish before processing any updates
if cleanNeeded: if cleanNeeded:
self.doKodiLibraryUpdate(True) self.doKodiLibraryUpdate(True, pDialog)
addon.setSetting("SyncFirstMovieRunDone", "true")
finally: finally:
if(pDialog != None): if(pDialog != None):
pDialog.close() pDialog.close()
@ -214,14 +221,17 @@ class LibrarySync():
enableProgress = False enableProgress = False
if addon.getSetting("enableProgressFullSync") == 'true': if addon.getSetting("enableProgressFullSync") == 'true':
enableProgress = True enableProgress = True
startupStr = WINDOW.getProperty("startup")
if startupStr != "done": if(addon.getSetting("SyncFirstTVRunDone") != 'true'):
enableProgress = True pDialog = xbmcgui.DialogProgress()
if(enableProgress): elif(enableProgress):
pDialog = xbmcgui.DialogProgressBG() pDialog = xbmcgui.DialogProgressBG()
if(pDialog != None): if(pDialog != None):
pDialog.create('Sync DB', 'Sync DB') pDialog.create('Sync DB', 'Sync DB')
progressTitle = "Sync DB : Processing Episodes"
# incremental sync --> new episodes only # incremental sync --> new episodes only
if not fullsync: if not fullsync:
@ -233,7 +243,7 @@ class LibrarySync():
updateNeeded = False updateNeeded = False
if(pDialog != None): if(pDialog != None):
pDialog.update(0, "Sync DB : Processing Episodes") pDialog.update(0, progressTitle)
total = len(latestMBEpisodes) + 1 total = len(latestMBEpisodes) + 1
count = 1 count = 1
@ -243,7 +253,7 @@ class LibrarySync():
#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(episode["SeriesId"]) kodiEpisodes = ReadKodiDB().getKodiEpisodes(episode["SeriesId"])
if(self.ShouldStop()): if(self.ShouldStop(pDialog)):
return True return True
#we have to compare the lists somehow #we have to compare the lists somehow
@ -253,29 +263,32 @@ class LibrarySync():
KodiItem = kodiEpisodes.get(comparestring1, None) KodiItem = kodiEpisodes.get(comparestring1, None)
if(KodiItem != None): if(KodiItem != None):
matchFound = True matchFound = True
progressAction = "Checking"
if not matchFound: if not matchFound:
#no match so we have to create it #no match so we have to create it
WriteKodiDB().addEpisodeToKodiLibrary(episode) WriteKodiDB().addEpisodeToKodiLibrary(episode)
updateNeeded = True updateNeeded = True
progressAction = "Adding"
if(self.ShouldStop()): if(self.ShouldStop(pDialog)):
return True return True
# update progress bar # update progress bar
if(pDialog != None): if(pDialog != None):
percentage = int(((float(count) / float(total)) * 100)) percentage = int(((float(count) / float(total)) * 100))
pDialog.update(percentage, message="Adding Episode: " + str(count)) pDialog.update(percentage, progressTitle, progressAction + " Episode: " + str(count))
count += 1 count += 1
#initiate library update and wait for finish before processing any updates #initiate library update and wait for finish before processing any updates
if updateNeeded: if updateNeeded:
self.doKodiLibraryUpdate() self.doKodiLibraryUpdate(False, pDialog)
updateNeeded = False updateNeeded = False
#process updates #process updates
if(pDialog != None): if(pDialog != None):
pDialog.update(0, "Sync DB : Processing Episodes") progressTitle = "Sync DB : Processing Episodes"
pDialog.update(0, progressTitle)
total = len(latestMBEpisodes) + 1 total = len(latestMBEpisodes) + 1
count = 1 count = 1
@ -284,7 +297,7 @@ class LibrarySync():
#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(episode["SeriesId"]) kodiEpisodes = ReadKodiDB().getKodiEpisodes(episode["SeriesId"])
if(self.ShouldStop()): if(self.ShouldStop(pDialog)):
return True return True
#we have to compare the lists somehow #we have to compare the lists somehow
@ -295,13 +308,13 @@ class LibrarySync():
if(KodiItem != None): if(KodiItem != None):
WriteKodiDB().updateEpisodeToKodiLibrary(episode, KodiItem) WriteKodiDB().updateEpisodeToKodiLibrary(episode, KodiItem)
if(self.ShouldStop()): if(self.ShouldStop(pDialog)):
return True return True
# update progress bar # update progress bar
if(pDialog != None): if(pDialog != None):
percentage = int(((float(count) / float(total)) * 100)) percentage = int(((float(count) / float(total)) * 100))
pDialog.update(percentage, message="Updating Episode: " + str(count)) pDialog.update(percentage, progressTitle, "Updating Episode: " + str(count))
count += 1 count += 1
@ -314,14 +327,15 @@ class LibrarySync():
updateNeeded = False updateNeeded = False
if(self.ShouldStop()): if(self.ShouldStop(pDialog)):
return True return True
if (tvShowData == None): if (tvShowData == None):
return return
if(pDialog != None): if(pDialog != None):
pDialog.update(0, "Sync DB : Processing TV Shows") progressTitle = "Sync DB : Processing TV Shows"
pDialog.update(0, progressTitle)
total = len(tvShowData) + 1 total = len(tvShowData) + 1
count = 1 count = 1
@ -338,26 +352,26 @@ class LibrarySync():
WriteKodiDB().updateTVShowToKodiLibrary(item, kodiItem) WriteKodiDB().updateTVShowToKodiLibrary(item, kodiItem)
progMessage = "Updating" progMessage = "Updating"
if(self.ShouldStop()): if(self.ShouldStop(pDialog)):
return True return True
# update progress bar # update progress bar
if(pDialog != None): if(pDialog != None):
percentage = int(((float(count) / float(total)) * 100)) percentage = int(((float(count) / float(total)) * 100))
pDialog.update(percentage, message=progMessage + " Tv Show: " + str(count)) pDialog.update(percentage, progressTitle, progMessage + " Tv Show: " + str(count))
count += 1 count += 1
#initiate library update and wait for finish before processing any updates #initiate library update and wait for finish before processing any updates
if updateNeeded: if updateNeeded:
if(pDialog != None): if(pDialog != None and type(pDialog) == xbmcgui.DialogProgressBG):
pDialog.close() pDialog.close()
self.doKodiLibraryUpdate() self.doKodiLibraryUpdate(False, pDialog)
updateNeeded = False updateNeeded = False
if(pDialog != None): if(pDialog != None and type(pDialog) == xbmcgui.DialogProgressBG):
pDialog.create('Sync DB', 'Sync DB') pDialog.create('Sync DB', 'Sync DB')
#process episodes (will only be possible when tv show is scanned to library) #process episodes (will only be possible when tv show is scanned to library)
@ -373,11 +387,12 @@ class LibrarySync():
episodeData = ReadEmbyDB().getEpisodes(tvshow,True) episodeData = ReadEmbyDB().getEpisodes(tvshow,True)
kodiEpisodes = ReadKodiDB().getKodiEpisodes(tvshow) kodiEpisodes = ReadKodiDB().getKodiEpisodes(tvshow)
if(self.ShouldStop()): if(self.ShouldStop(pDialog)):
return True return True
if(pDialog != None): if(pDialog != None):
pDialog.update(0, "Sync DB : Processing Tv Show " + str(showCurrent) + " of " + str(showTotal)) progressTitle = "Sync DB : Processing Tv Show " + str(showCurrent) + " of " + str(showTotal)
pDialog.update(0, progressTitle)
total = len(episodeData) + 1 total = len(episodeData) + 1
count = 0 count = 0
@ -390,31 +405,33 @@ class LibrarySync():
if(KodiItem != None): if(KodiItem != None):
matchFound = True matchFound = True
progressAction = "Checking"
if not matchFound: if not matchFound:
#no match so we have to create it #no match so we have to create it
WriteKodiDB().addEpisodeToKodiLibrary(item) WriteKodiDB().addEpisodeToKodiLibrary(item)
updateNeeded = True updateNeeded = True
progressAction = "Adding"
if(self.ShouldStop()): if(self.ShouldStop(pDialog)):
return True return True
# update progress bar # update progress bar
if(pDialog != None): if(pDialog != None):
percentage = int(((float(count) / float(total)) * 100)) percentage = int(((float(count) / float(total)) * 100))
pDialog.update(percentage, message="Adding Episode: " + str(count)) pDialog.update(percentage, progressTitle, progressAction + " Episode: " + str(count))
count += 1 count += 1
showCurrent += 1 showCurrent += 1
#initiate library update and wait for finish before processing any updates #initiate library update and wait for finish before processing any updates
if updateNeeded: if updateNeeded:
if(pDialog != None): if(pDialog != None and type(pDialog) == xbmcgui.DialogProgressBG):
pDialog.close() pDialog.close()
self.doKodiLibraryUpdate() self.doKodiLibraryUpdate(False, pDialog)
updateNeeded = False updateNeeded = False
if(pDialog != None): if(pDialog != None and type(pDialog) == xbmcgui.DialogProgressBG):
pDialog.create('Sync DB', 'Sync DB') pDialog.create('Sync DB', 'Sync DB')
# do episode updates # do episode updates
@ -424,11 +441,12 @@ class LibrarySync():
episodeData = ReadEmbyDB().getEpisodes(tvshow,True) episodeData = ReadEmbyDB().getEpisodes(tvshow,True)
kodiEpisodes = ReadKodiDB().getKodiEpisodes(tvshow) kodiEpisodes = ReadKodiDB().getKodiEpisodes(tvshow)
if(self.ShouldStop()): if(self.ShouldStop(pDialog)):
return True return True
if(pDialog != None): if(pDialog != None):
pDialog.update(0, "Sync DB : Processing Tv Show " + str(showCurrent) + " of " + str(showTotal)) progressTitle = "Sync DB : Processing Tv Show " + str(showCurrent) + " of " + str(showTotal)
pDialog.update(0, progressTitle)
total = len(episodeData) + 1 total = len(episodeData) + 1
count = 0 count = 0
@ -441,21 +459,22 @@ class LibrarySync():
if(KodiItem != None): if(KodiItem != None):
WriteKodiDB().updateEpisodeToKodiLibrary(item, KodiItem) WriteKodiDB().updateEpisodeToKodiLibrary(item, KodiItem)
if(self.ShouldStop()): if(self.ShouldStop(pDialog)):
return True return True
# update progress bar # update progress bar
if(pDialog != None): if(pDialog != None):
percentage = int(((float(count) / float(total)) * 100)) percentage = int(((float(count) / float(total)) * 100))
pDialog.update(percentage, message="Updating Episode: " + str(count)) pDialog.update(percentage, progressTitle, "Updating Episode: " + str(count))
count += 1 count += 1
showCurrent += 1 showCurrent += 1
if(pDialog != None): if(pDialog != None):
pDialog.update(0, message="Removing Deleted Items") progressTitle = "Removing Deleted Items"
pDialog.update(0, progressTitle)
if(self.ShouldStop()): if(self.ShouldStop(pDialog)):
return True return True
cleanNeeded = False cleanNeeded = False
@ -470,21 +489,22 @@ class LibrarySync():
WriteKodiDB().deleteTVShowFromKodiLibrary(dir) WriteKodiDB().deleteTVShowFromKodiLibrary(dir)
cleanneeded = True cleanneeded = True
if(self.ShouldStop()): if(self.ShouldStop(pDialog)):
return True return True
#initiate library clean and wait for finish before processing any updates #initiate library clean and wait for finish before processing any updates
if cleanNeeded: if cleanNeeded:
self.doKodiLibraryUpdate(True) self.doKodiLibraryUpdate(True, pDialog)
addon.setSetting("SyncFirstTVRunDone", "true")
finally: finally:
if(pDialog != None): if(pDialog != None):
pDialog.close() pDialog.close()
return True return True
def doKodiLibraryUpdate(self, clean, prog):
def doKodiLibraryUpdate(self,clean=False):
#initiate library update and wait for finish before processing any updates #initiate library update and wait for finish before processing any updates
if clean: if clean:
xbmc.executebuiltin("CleanLibrary(video)") xbmc.executebuiltin("CleanLibrary(video)")
@ -492,9 +512,9 @@ class LibrarySync():
xbmc.executebuiltin("UpdateLibrary(video)") xbmc.executebuiltin("UpdateLibrary(video)")
xbmc.sleep(1000) xbmc.sleep(1000)
while (xbmc.getCondVisibility("Library.IsScanningVideo")): while (xbmc.getCondVisibility("Library.IsScanningVideo")):
if(self.ShouldStop()): if(self.ShouldStop(prog)):
return True return True
xbmc.sleep(250) xbmc.sleep(1000)
def updatePlayCounts(self): def updatePlayCounts(self):
#update all playcounts from MB3 to Kodi library #update all playcounts from MB3 to Kodi library
@ -510,13 +530,20 @@ class LibrarySync():
enableProgress = False enableProgress = False
if addon.getSetting("enableProgressPlayCountSync") == 'true': if addon.getSetting("enableProgressPlayCountSync") == 'true':
enableProgress = True enableProgress = True
if(enableProgress):
if(addon.getSetting("SyncFirstCountsRunDone") != 'true'):
pDialog = xbmcgui.DialogProgress()
elif(enableProgress):
pDialog = xbmcgui.DialogProgressBG() pDialog = xbmcgui.DialogProgressBG()
if(pDialog != None): if(pDialog != None):
pDialog.create('Sync PlayCounts', 'Sync PlayCounts') pDialog.create('Sync PlayCounts', 'Sync PlayCounts')
#process movies #process movies
if processMovies: if processMovies:
if(pDialog != None):
pDialog.update(0, "Processing Movies", "")
views = ReadEmbyDB().getCollections("movies") views = ReadEmbyDB().getCollections("movies")
viewCount = len(views) viewCount = len(views)
viewCurrent = 1 viewCurrent = 1
@ -524,7 +551,7 @@ class LibrarySync():
allMB3Movies = ReadEmbyDB().getMovies(view.get('id'), fullinfo = False, fullSync = True) allMB3Movies = ReadEmbyDB().getMovies(view.get('id'), fullinfo = False, fullSync = True)
allKodiMovies = ReadKodiDB().getKodiMovies(False) allKodiMovies = ReadKodiDB().getKodiMovies(False)
if(self.ShouldStop()): if(self.ShouldStop(pDialog)):
return True return True
if(allMB3Movies == None): if(allMB3Movies == None):
@ -534,7 +561,8 @@ class LibrarySync():
return False return False
if(pDialog != None): if(pDialog != None):
pDialog.update(0, "Sync PlayCounts: Processing " + view.get('title') + " " + str(viewCurrent) + " of " + str(viewCount)) progressTitle = "Sync PlayCounts: Processing " + view.get('title') + " " + str(viewCurrent) + " of " + str(viewCount)
pDialog.update(0, progressTitle)
totalCount = len(allMB3Movies) + 1 totalCount = len(allMB3Movies) + 1
count = 1 count = 1
@ -554,22 +582,25 @@ class LibrarySync():
if kodiresume != resume: if kodiresume != resume:
WriteKodiDB().setKodiResumePoint(kodiItem['movieid'],resume,total,"movie") WriteKodiDB().setKodiResumePoint(kodiItem['movieid'],resume,total,"movie")
if(self.ShouldStop()): if(self.ShouldStop(pDialog)):
return True return True
# update progress bar # update progress bar
if(pDialog != None): if(pDialog != None):
percentage = int(((float(count) / float(totalCount)) * 100)) percentage = int(((float(count) / float(totalCount)) * 100))
pDialog.update(percentage, message="Updating Movie: " + str(count)) pDialog.update(percentage, progressTitle, "Updating Movie: " + str(count))
count += 1 count += 1
viewCurrent += 1 viewCurrent += 1
#process Tv shows #process Tv shows
if processTvShows: if processTvShows:
if(pDialog != None):
pDialog.update(0, "Processing TV Episodes", "")
tvshowData = ReadEmbyDB().getTVShows(fullinfo = False, fullSync = True) tvshowData = ReadEmbyDB().getTVShows(fullinfo = False, fullSync = True)
if(self.ShouldStop()): if(self.ShouldStop(pDialog)):
return True return True
if (tvshowData == None): if (tvshowData == None):
@ -585,7 +616,8 @@ class LibrarySync():
if (episodeData != None): if (episodeData != None):
if(pDialog != None): if(pDialog != None):
pDialog.update(0, "Sync PlayCounts: Processing TV Show " + str(showCurrent) + " of " + str(showTotal)) progressTitle = "Sync PlayCounts: Processing TV Show " + str(showCurrent) + " of " + str(showTotal)
pDialog.update(0, progressTitle)
totalCount = len(episodeData) + 1 totalCount = len(episodeData) + 1
count = 1 count = 1
@ -608,16 +640,19 @@ class LibrarySync():
if kodiresume != resume: if kodiresume != resume:
WriteKodiDB().setKodiResumePoint(kodiItem['episodeid'],resume,total,"episode") WriteKodiDB().setKodiResumePoint(kodiItem['episodeid'],resume,total,"episode")
if(self.ShouldStop()): if(self.ShouldStop(pDialog)):
return True return True
# update progress bar # update progress bar
if(pDialog != None): if(pDialog != None):
percentage = int(((float(count) / float(totalCount)) * 100)) percentage = int(((float(count) / float(totalCount)) * 100))
pDialog.update(percentage, message="Updating Episode: " + str(count)) pDialog.update(percentage, progressTitle, "Updating Episode: " + str(count))
count += 1 count += 1
showCurrent += 1 showCurrent += 1
addon.setSetting("SyncFirstCountsRunDone", "true")
finally: finally:
if(pDialog != None): if(pDialog != None):
pDialog.close() pDialog.close()
@ -633,7 +668,7 @@ class LibrarySync():
if type=='Movie': if type=='Movie':
MB3Movie = ReadEmbyDB().getItem(itemID) MB3Movie = ReadEmbyDB().getItem(itemID)
kodiItem = ReadKodiDB().getKodiMovie(itemID) kodiItem = ReadKodiDB().getKodiMovie(itemID)
if(self.ShouldStop()): if(self.ShouldStop(None)):
return True return True
if(MB3Movie == None): if(MB3Movie == None):
@ -653,12 +688,12 @@ class LibrarySync():
WriteKodiDB().setKodiResumePoint(kodiItem['movieid'],resume,total,"movie") WriteKodiDB().setKodiResumePoint(kodiItem['movieid'],resume,total,"movie")
#write property forced will refresh the item in the list so playcount change is immediately visible #write property forced will refresh the item in the list so playcount change is immediately visible
WriteKodiDB().updateProperty(kodiItem,"playcount",int(userData.get("PlayCount")),"movie",True) WriteKodiDB().updateProperty(kodiItem,"playcount",int(userData.get("PlayCount")),"movie",True)
if(self.ShouldStop()): if(self.ShouldStop(None)):
return True return True
#process episode #process episode
elif type=='Episode': elif type=='Episode':
if(self.ShouldStop()): if(self.ShouldStop(None)):
return True return True
MB3Episode = ReadEmbyDB().getItem(itemID) MB3Episode = ReadEmbyDB().getItem(itemID)
@ -674,12 +709,17 @@ class LibrarySync():
WriteKodiDB().setKodiResumePoint(kodiItem['episodeid'],resume,total,"episode") WriteKodiDB().setKodiResumePoint(kodiItem['episodeid'],resume,total,"episode")
#write property forced will refresh the item in the list so playcount change is immediately visible #write property forced will refresh the item in the list so playcount change is immediately visible
WriteKodiDB().updateProperty(kodiItem,"playcount",int(userData.get("PlayCount")),"episode",True) WriteKodiDB().updateProperty(kodiItem,"playcount",int(userData.get("PlayCount")),"episode",True)
if(self.ShouldStop()): if(self.ShouldStop(None)):
return True return True
return True return True
def ShouldStop(self): def ShouldStop(self, prog):
if(prog != None and type(prog) == xbmcgui.DialogProgress):
if(prog.iscanceled() == True):
return True
if(xbmc.Player().isPlaying() or xbmc.abortRequested): if(xbmc.Player().isPlaying() or xbmc.abortRequested):
return True return True
else: else: