remove all movies from box set before updating to cacth movies that have been removed
only sync box sets that have changed for inc sync
This commit is contained in:
parent
63bba9d450
commit
fc0442e0ed
2 changed files with 46 additions and 28 deletions
|
@ -249,6 +249,7 @@ class LibrarySync(threading.Thread):
|
||||||
#### PROCESS BOX SETS #####
|
#### PROCESS BOX SETS #####
|
||||||
if(pDialog != None):
|
if(pDialog != None):
|
||||||
utils.logMsg("Sync Movies", "BoxSet Sync Started", 1)
|
utils.logMsg("Sync Movies", "BoxSet Sync Started", 1)
|
||||||
|
|
||||||
boxsets = ReadEmbyDB().getBoxSets()
|
boxsets = ReadEmbyDB().getBoxSets()
|
||||||
|
|
||||||
total = len(boxsets) + 1
|
total = len(boxsets) + 1
|
||||||
|
@ -263,6 +264,7 @@ class LibrarySync(threading.Thread):
|
||||||
boxsetMovies = ReadEmbyDB().getMoviesInBoxSet(boxset["Id"])
|
boxsetMovies = ReadEmbyDB().getMoviesInBoxSet(boxset["Id"])
|
||||||
WriteKodiVideoDB().addBoxsetToKodiLibrary(boxset, connection, cursor)
|
WriteKodiVideoDB().addBoxsetToKodiLibrary(boxset, connection, cursor)
|
||||||
|
|
||||||
|
WriteKodiVideoDB().removeMoviesFromBoxset(boxset, connection, cursor)
|
||||||
for boxsetMovie in boxsetMovies:
|
for boxsetMovie in boxsetMovies:
|
||||||
if(self.ShouldStop()):
|
if(self.ShouldStop()):
|
||||||
return False
|
return False
|
||||||
|
@ -628,6 +630,8 @@ class LibrarySync(threading.Thread):
|
||||||
count = 1
|
count = 1
|
||||||
total = len(boxsets) + 1
|
total = len(boxsets) + 1
|
||||||
for boxset in boxsets:
|
for boxset in boxsets:
|
||||||
|
if(boxset["Id"] in itemList):
|
||||||
|
utils.logMsg("IncrementalSync", "Updating box Set : " + str(boxset["Name"]), 1)
|
||||||
boxsetMovies = ReadEmbyDB().getMoviesInBoxSet(boxset["Id"])
|
boxsetMovies = ReadEmbyDB().getMoviesInBoxSet(boxset["Id"])
|
||||||
WriteKodiVideoDB().addBoxsetToKodiLibrary(boxset, connection, cursor)
|
WriteKodiVideoDB().addBoxsetToKodiLibrary(boxset, connection, cursor)
|
||||||
if(pDialog != None):
|
if(pDialog != None):
|
||||||
|
@ -635,8 +639,11 @@ class LibrarySync(threading.Thread):
|
||||||
percentage = int(((float(count) / float(total)) * 100))
|
percentage = int(((float(count) / float(total)) * 100))
|
||||||
pDialog.update(percentage, "Emby for Kodi - Incremental Sync BoxSet", progressTitle)
|
pDialog.update(percentage, "Emby for Kodi - Incremental Sync BoxSet", progressTitle)
|
||||||
count = count + 1
|
count = count + 1
|
||||||
|
WriteKodiVideoDB().removeMoviesFromBoxset(boxset, connection, cursor)
|
||||||
for boxsetMovie in boxsetMovies:
|
for boxsetMovie in boxsetMovies:
|
||||||
WriteKodiVideoDB().updateBoxsetToKodiLibrary(boxsetMovie, boxset, connection, cursor)
|
WriteKodiVideoDB().updateBoxsetToKodiLibrary(boxsetMovie, boxset, connection, cursor)
|
||||||
|
else:
|
||||||
|
utils.logMsg("IncrementalSync", "Skipping Box Set : " + boxset["Name"], 1)
|
||||||
|
|
||||||
#### PROCESS TV SHOWS ####
|
#### PROCESS TV SHOWS ####
|
||||||
views = ReadEmbyDB().getCollections("tvshows")
|
views = ReadEmbyDB().getCollections("tvshows")
|
||||||
|
|
|
@ -1233,6 +1233,17 @@ class WriteKodiVideoDB():
|
||||||
query = "UPDATE emby SET checksum = ? WHERE emby_id = ?"
|
query = "UPDATE emby SET checksum = ? WHERE emby_id = ?"
|
||||||
cursor.execute(query, (API().getChecksum(boxsetmovie), boxsetmovieid))
|
cursor.execute(query, (API().getChecksum(boxsetmovie), boxsetmovieid))
|
||||||
|
|
||||||
|
def removeMoviesFromBoxset(self, boxset, connection, cursor):
|
||||||
|
|
||||||
|
strSet = boxset['Name']
|
||||||
|
try:
|
||||||
|
cursor.execute("SELECT idSet FROM sets WHERE strSet = ? COLLATE NOCASE", (strSet,))
|
||||||
|
setid = cursor.fetchone()[0]
|
||||||
|
except: pass
|
||||||
|
else:
|
||||||
|
query = "UPDATE movie SET idSet = null WHERE idSet = ?"
|
||||||
|
cursor.execute(query, (setid,))
|
||||||
|
|
||||||
def updateUserdata(self, userdata, connection, cursor):
|
def updateUserdata(self, userdata, connection, cursor):
|
||||||
# This updates: Favorite, LastPlayedDate, Playcount, PlaybackPositionTicks
|
# This updates: Favorite, LastPlayedDate, Playcount, PlaybackPositionTicks
|
||||||
embyId = userdata['ItemId']
|
embyId = userdata['ItemId']
|
||||||
|
|
Loading…
Reference in a new issue