Move the BoxSet Sync outside the Views processing and make it optional

plus add some ShouldStop calls
This commit is contained in:
shaun 2015-03-26 12:03:06 +11:00
parent e5cb446c7d
commit 43a77bbba2
3 changed files with 19 additions and 10 deletions

View file

@ -236,6 +236,7 @@
<string id="30235">Extras</string> <string id="30235">Extras</string>
<string id="30236">Sync Theme Music</string> <string id="30236">Sync Theme Music</string>
<string id="30237">Sync Extra Fanart</string> <string id="30237">Sync Extra Fanart</string>
<string id="30238">Sync Movie BoxSets</string>
<!-- Default views --> <!-- Default views -->
<string id="30300">Active</string> <string id="30300">Active</string>

View file

@ -166,14 +166,6 @@ class LibrarySync():
total = len(allMB3Movies) + 1 total = len(allMB3Movies) + 1
count = 1 count = 1
# process box sets - TODO cope with movies removed from a set
boxsets = ReadEmbyDB().getBoxSets()
for boxset in boxsets:
boxsetMovies = ReadEmbyDB().getMoviesInBoxSet(boxset["Id"])
WriteKodiDB().addBoxsetToKodiLibrary(boxset)
for boxsetMovie in boxsetMovies:
WriteKodiDB().updateBoxsetToKodiLibrary(boxsetMovie,boxset)
#process updates #process updates
allKodiMovies = ReadKodiDB().getKodiMovies(True) allKodiMovies = ReadKodiDB().getKodiMovies(True)
for item in allMB3Movies: for item in allMB3Movies:
@ -200,6 +192,21 @@ class LibrarySync():
viewCurrent += 1 viewCurrent += 1
# process box sets - TODO cope with movies removed from a set
if fullsync and addon.getSetting("syncMovieBoxSets") == "true":
utils.logMsg("Sync Movies", "BoxSet Sync Started", 1)
boxsets = ReadEmbyDB().getBoxSets()
for boxset in boxsets:
if(self.ShouldStop(pDialog)):
return True
boxsetMovies = ReadEmbyDB().getMoviesInBoxSet(boxset["Id"])
WriteKodiDB().addBoxsetToKodiLibrary(boxset)
for boxsetMovie in boxsetMovies:
if(self.ShouldStop(pDialog)):
return True
WriteKodiDB().updateBoxsetToKodiLibrary(boxsetMovie,boxset)
utils.logMsg("Sync Movies", "BoxSet Sync Finished", 1)
if(pDialog != None): if(pDialog != None):
progressTitle = "Removing Deleted Items" progressTitle = "Removing Deleted Items"
pDialog.update(0, progressTitle, "") pDialog.update(0, progressTitle, "")

View file

@ -10,7 +10,7 @@
<category label="Automatic sync"> <!-- Auto sync optionss --> <category label="Automatic sync"> <!-- Auto sync optionss -->
<setting id="enablePlayCountSync" type="bool" label="Enable watched/resume status sync" default="true" visible="true" enable="true" /> <setting id="enablePlayCountSync" type="bool" label="Enable watched/resume status sync" default="true" visible="true" enable="true" />
<setting id="syncSettingStartup" type="labelenum" label="Startup Sync:" values="Full Sync|Incremental Sync|None" default="Full Sync" /> <setting id="syncSettingStartup" type="labelenum" label="Startup Sync:" values="Full Sync|Incremental Sync|None" default="Full Sync" />
<setting id="syncSettingBackground" type="labelenum" label="Scheduled Sync:" values="Full Sync|Incremental Sync|None" default="Full Sync" visible="true" enable="true" /> <setting id="syncSettingBackground" type="labelenum" label="Scheduled Sync:" values="Full Sync|Incremental Sync|None" default="Incremental Sync" visible="true" enable="true" />
<setting id="dbSyncIndication" type="labelenum" label="DB Sync Indication:" values="None|Notify OnChange|Notify OnFinish|BG Progress|Dialog Progress" default="None" /> <setting id="dbSyncIndication" type="labelenum" label="DB Sync Indication:" values="None|Notify OnChange|Notify OnFinish|BG Progress|Dialog Progress" default="None" />
<setting id="playCountSyncIndication" type="labelenum" label="Play Count Sync Indication:" values="None|Notify OnChange|Notify OnFinish|BG Progress|Dialog Progress" default="None" /> <setting id="playCountSyncIndication" type="labelenum" label="Play Count Sync Indication:" values="None|Notify OnChange|Notify OnFinish|BG Progress|Dialog Progress" default="None" />
</category> </category>
@ -28,6 +28,7 @@
<category label="30235"> <!-- Extra Sync options --> <category label="30235"> <!-- Extra Sync options -->
<setting id="syncThemeMusic" type="bool" label="30236" default="false" visible="true" enable="true" /> <setting id="syncThemeMusic" type="bool" label="30236" default="false" visible="true" enable="true" />
<setting id="syncExtraFanart" type="bool" label="30237" default="false" visible="true" enable="true" /> <setting id="syncExtraFanart" type="bool" label="30237" default="false" visible="true" enable="true" />
<setting id="syncMovieBoxSets" type="bool" label="30238" default="false" visible="true" enable="true" />
</category> </category>
<category label="30022"> <!-- Advanced --> <category label="30022"> <!-- Advanced -->