break out of loop after plugin found
This commit is contained in:
parent
828d47b533
commit
d8ba247d99
1 changed files with 59 additions and 58 deletions
|
@ -76,7 +76,7 @@ class LibrarySync(threading.Thread):
|
||||||
settings = utils.settings
|
settings = utils.settings
|
||||||
# Run at start up - optional to use the server plugin
|
# Run at start up - optional to use the server plugin
|
||||||
if settings('SyncInstallRunDone') == "true":
|
if settings('SyncInstallRunDone') == "true":
|
||||||
|
|
||||||
# Validate views
|
# Validate views
|
||||||
self.refreshViews()
|
self.refreshViews()
|
||||||
completed = False
|
completed = False
|
||||||
|
@ -90,14 +90,15 @@ class LibrarySync(threading.Thread):
|
||||||
if plugin['Name'] == "Emby.Kodi Sync Queue":
|
if plugin['Name'] == "Emby.Kodi Sync Queue":
|
||||||
self.logMsg("Found server plugin.", 2)
|
self.logMsg("Found server plugin.", 2)
|
||||||
completed = self.fastSync()
|
completed = self.fastSync()
|
||||||
|
break
|
||||||
|
|
||||||
if not completed:
|
if not completed:
|
||||||
# Fast sync failed or server plugin is not found
|
# Fast sync failed or server plugin is not found
|
||||||
completed = ManualSync().sync()
|
completed = ManualSync().sync()
|
||||||
else:
|
else:
|
||||||
# Install sync is not completed
|
# Install sync is not completed
|
||||||
completed = self.fullSync()
|
completed = self.fullSync()
|
||||||
|
|
||||||
return completed
|
return completed
|
||||||
|
|
||||||
def fastSync(self):
|
def fastSync(self):
|
||||||
|
@ -109,10 +110,10 @@ class LibrarySync(threading.Thread):
|
||||||
lastSync = utils.settings('LastIncrementalSync')
|
lastSync = utils.settings('LastIncrementalSync')
|
||||||
if not lastSync:
|
if not lastSync:
|
||||||
lastSync = "2010-01-01T00:00:00Z"
|
lastSync = "2010-01-01T00:00:00Z"
|
||||||
|
|
||||||
lastSyncTime = utils.convertdate(lastSync)
|
lastSyncTime = utils.convertdate(lastSync)
|
||||||
log("Last sync run: %s" % lastSyncTime, 1)
|
log("Last sync run: %s" % lastSyncTime, 1)
|
||||||
|
|
||||||
# get server RetentionDateTime
|
# get server RetentionDateTime
|
||||||
url = "{server}/emby/Emby.Kodi.SyncQueue/GetServerDateTime?format=json"
|
url = "{server}/emby/Emby.Kodi.SyncQueue/GetServerDateTime?format=json"
|
||||||
result = doUtils(url)
|
result = doUtils(url)
|
||||||
|
@ -135,24 +136,24 @@ class LibrarySync(threading.Thread):
|
||||||
if retention_time > lastSyncTime:
|
if retention_time > lastSyncTime:
|
||||||
log("Fast sync server retention insufficient, fall back to full sync", 1)
|
log("Fast sync server retention insufficient, fall back to full sync", 1)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
url = "{server}/emby/Emby.Kodi.SyncQueue/{UserId}/GetItems?format=json"
|
url = "{server}/emby/Emby.Kodi.SyncQueue/{UserId}/GetItems?format=json"
|
||||||
params = {'LastUpdateDT': lastSync}
|
params = {'LastUpdateDT': lastSync}
|
||||||
result = doUtils(url, parameters=params)
|
result = doUtils(url, parameters=params)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
processlist = {
|
processlist = {
|
||||||
|
|
||||||
'added': result['ItemsAdded'],
|
'added': result['ItemsAdded'],
|
||||||
'update': result['ItemsUpdated'],
|
'update': result['ItemsUpdated'],
|
||||||
'userdata': result['UserDataChanged'],
|
'userdata': result['UserDataChanged'],
|
||||||
'remove': result['ItemsRemoved']
|
'remove': result['ItemsRemoved']
|
||||||
}
|
}
|
||||||
|
|
||||||
except (KeyError, TypeError):
|
except (KeyError, TypeError):
|
||||||
log("Failed to retrieve latest updates using fast sync.", 1)
|
log("Failed to retrieve latest updates using fast sync.", 1)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
else:
|
else:
|
||||||
log("Fast sync changes: %s" % result, 1)
|
log("Fast sync changes: %s" % result, 1)
|
||||||
for action in processlist:
|
for action in processlist:
|
||||||
|
@ -171,7 +172,7 @@ class LibrarySync(threading.Thread):
|
||||||
try: # datetime fails when used more than once, TypeError
|
try: # datetime fails when used more than once, TypeError
|
||||||
server_time = result['ServerDateTime']
|
server_time = result['ServerDateTime']
|
||||||
server_time = utils.convertdate(server_time)
|
server_time = utils.convertdate(server_time)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# If the server plugin is not installed or an error happened.
|
# If the server plugin is not installed or an error happened.
|
||||||
log("An exception occurred: %s" % e, 1)
|
log("An exception occurred: %s" % e, 1)
|
||||||
|
@ -196,7 +197,7 @@ class LibrarySync(threading.Thread):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def dbCommit(self, connection):
|
def dbCommit(self, connection):
|
||||||
|
|
||||||
log = self.logMsg
|
log = self.logMsg
|
||||||
window = utils.window
|
window = utils.window
|
||||||
# Central commit, verifies if Kodi database update is running
|
# Central commit, verifies if Kodi database update is running
|
||||||
|
@ -241,14 +242,14 @@ class LibrarySync(threading.Thread):
|
||||||
# emby, view, version
|
# emby, view, version
|
||||||
embycursor.execute(
|
embycursor.execute(
|
||||||
"""CREATE TABLE IF NOT EXISTS emby(
|
"""CREATE TABLE IF NOT EXISTS emby(
|
||||||
emby_id TEXT UNIQUE, media_folder TEXT, emby_type TEXT, media_type TEXT, kodi_id INTEGER,
|
emby_id TEXT UNIQUE, media_folder TEXT, emby_type TEXT, media_type TEXT, kodi_id INTEGER,
|
||||||
kodi_fileid INTEGER, kodi_pathid INTEGER, parent_id INTEGER, checksum INTEGER)""")
|
kodi_fileid INTEGER, kodi_pathid INTEGER, parent_id INTEGER, checksum INTEGER)""")
|
||||||
embycursor.execute(
|
embycursor.execute(
|
||||||
"""CREATE TABLE IF NOT EXISTS view(
|
"""CREATE TABLE IF NOT EXISTS view(
|
||||||
view_id TEXT UNIQUE, view_name TEXT, media_type TEXT, kodi_tagid INTEGER)""")
|
view_id TEXT UNIQUE, view_name TEXT, media_type TEXT, kodi_tagid INTEGER)""")
|
||||||
embycursor.execute("CREATE TABLE IF NOT EXISTS version(idVersion TEXT)")
|
embycursor.execute("CREATE TABLE IF NOT EXISTS version(idVersion TEXT)")
|
||||||
embyconn.commit()
|
embyconn.commit()
|
||||||
|
|
||||||
# content sync: movies, tvshows, musicvideos, music
|
# content sync: movies, tvshows, musicvideos, music
|
||||||
kodiconn = utils.kodiSQL('video')
|
kodiconn = utils.kodiSQL('video')
|
||||||
kodicursor = kodiconn.cursor()
|
kodicursor = kodiconn.cursor()
|
||||||
|
@ -262,14 +263,14 @@ class LibrarySync(threading.Thread):
|
||||||
message = "Initial sync"
|
message = "Initial sync"
|
||||||
forceddialog = True
|
forceddialog = True
|
||||||
window('emby_initialScan', value="true")
|
window('emby_initialScan', value="true")
|
||||||
|
|
||||||
pDialog = self.progressDialog("%s" % message, forced=forceddialog)
|
pDialog = self.progressDialog("%s" % message, forced=forceddialog)
|
||||||
starttotal = datetime.now()
|
starttotal = datetime.now()
|
||||||
|
|
||||||
# Set views
|
# Set views
|
||||||
self.maintainViews(embycursor, kodicursor)
|
self.maintainViews(embycursor, kodicursor)
|
||||||
embyconn.commit()
|
embyconn.commit()
|
||||||
|
|
||||||
# Sync video library
|
# Sync video library
|
||||||
process = {
|
process = {
|
||||||
|
|
||||||
|
@ -302,10 +303,10 @@ class LibrarySync(threading.Thread):
|
||||||
|
|
||||||
# sync music
|
# sync music
|
||||||
if music_enabled:
|
if music_enabled:
|
||||||
|
|
||||||
musicconn = utils.kodiSQL('music')
|
musicconn = utils.kodiSQL('music')
|
||||||
musiccursor = musicconn.cursor()
|
musiccursor = musicconn.cursor()
|
||||||
|
|
||||||
startTime = datetime.now()
|
startTime = datetime.now()
|
||||||
completed = self.music(embycursor, musiccursor, pDialog)
|
completed = self.music(embycursor, musiccursor, pDialog)
|
||||||
if not completed:
|
if not completed:
|
||||||
|
@ -328,9 +329,9 @@ class LibrarySync(threading.Thread):
|
||||||
|
|
||||||
if pDialog:
|
if pDialog:
|
||||||
pDialog.close()
|
pDialog.close()
|
||||||
|
|
||||||
embycursor.close()
|
embycursor.close()
|
||||||
|
|
||||||
settings('SyncInstallRunDone', value="true")
|
settings('SyncInstallRunDone', value="true")
|
||||||
settings("dbCreatedWithVersion", self.clientInfo.getVersion())
|
settings("dbCreatedWithVersion", self.clientInfo.getVersion())
|
||||||
self.saveLastSync()
|
self.saveLastSync()
|
||||||
|
@ -344,7 +345,7 @@ class LibrarySync(threading.Thread):
|
||||||
if forceddialog:
|
if forceddialog:
|
||||||
xbmcgui.Dialog().notification(
|
xbmcgui.Dialog().notification(
|
||||||
heading="Emby for Kodi",
|
heading="Emby for Kodi",
|
||||||
message="%s %s %s" %
|
message="%s %s %s" %
|
||||||
(message, utils.language(33025), str(elapsedtotal).split('.')[0]),
|
(message, utils.language(33025), str(elapsedtotal).split('.')[0]),
|
||||||
icon="special://home/addons/plugin.video.emby/icon.png",
|
icon="special://home/addons/plugin.video.emby/icon.png",
|
||||||
sound=False)
|
sound=False)
|
||||||
|
@ -360,7 +361,7 @@ class LibrarySync(threading.Thread):
|
||||||
|
|
||||||
# Compare views, assign correct tags to items
|
# Compare views, assign correct tags to items
|
||||||
self.maintainViews(embycursor, kodicursor)
|
self.maintainViews(embycursor, kodicursor)
|
||||||
|
|
||||||
self.dbCommit(kodiconn)
|
self.dbCommit(kodiconn)
|
||||||
kodicursor.close()
|
kodicursor.close()
|
||||||
|
|
||||||
|
@ -376,7 +377,7 @@ class LibrarySync(threading.Thread):
|
||||||
kodi_db = kodidb.Kodidb_Functions(kodicursor)
|
kodi_db = kodidb.Kodidb_Functions(kodicursor)
|
||||||
doUtils = self.doUtils
|
doUtils = self.doUtils
|
||||||
vnodes = self.vnodes
|
vnodes = self.vnodes
|
||||||
|
|
||||||
# Get views
|
# Get views
|
||||||
url = "{server}/emby/Users/{UserId}/Views?format=json"
|
url = "{server}/emby/Users/{UserId}/Views?format=json"
|
||||||
result = doUtils(url)
|
result = doUtils(url)
|
||||||
|
@ -388,7 +389,7 @@ class LibrarySync(threading.Thread):
|
||||||
all_views.append(view['name'])
|
all_views.append(view['name'])
|
||||||
if view['type'] == "music":
|
if view['type'] == "music":
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if view['type'] == "mixed":
|
if view['type'] == "mixed":
|
||||||
sorted_views.append(view['name'])
|
sorted_views.append(view['name'])
|
||||||
sorted_views.append(view['name'])
|
sorted_views.append(view['name'])
|
||||||
|
@ -421,7 +422,7 @@ class LibrarySync(threading.Thread):
|
||||||
folderid = folder['id']
|
folderid = folder['id']
|
||||||
foldername = folder['name']
|
foldername = folder['name']
|
||||||
viewtype = folder['type']
|
viewtype = folder['type']
|
||||||
|
|
||||||
if foldername not in all_views:
|
if foldername not in all_views:
|
||||||
# Media folders are grouped into userview
|
# Media folders are grouped into userview
|
||||||
url = "{server}/emby/Users/{UserId}/Items?format=json"
|
url = "{server}/emby/Users/{UserId}/Items?format=json"
|
||||||
|
@ -441,7 +442,7 @@ class LibrarySync(threading.Thread):
|
||||||
else:
|
else:
|
||||||
for grouped_view in grouped_views:
|
for grouped_view in grouped_views:
|
||||||
# This is only reserved for the detection of grouped views
|
# This is only reserved for the detection of grouped views
|
||||||
if (grouped_view['Type'] == "UserView" and
|
if (grouped_view['Type'] == "UserView" and
|
||||||
grouped_view.get('CollectionType') == mediatype):
|
grouped_view.get('CollectionType') == mediatype):
|
||||||
# Take the userview, and validate the item belong to the view
|
# Take the userview, and validate the item belong to the view
|
||||||
if emby.verifyView(grouped_view['Id'], verifyitem):
|
if emby.verifyView(grouped_view['Id'], verifyitem):
|
||||||
|
@ -455,7 +456,7 @@ class LibrarySync(threading.Thread):
|
||||||
sorted_views.append(foldername)
|
sorted_views.append(foldername)
|
||||||
log("Couldn't find corresponding grouped view: %s" % sorted_views, 1)
|
log("Couldn't find corresponding grouped view: %s" % sorted_views, 1)
|
||||||
|
|
||||||
# Failsafe
|
# Failsafe
|
||||||
try:
|
try:
|
||||||
sorted_views.index(foldername)
|
sorted_views.index(foldername)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
@ -506,7 +507,7 @@ class LibrarySync(threading.Thread):
|
||||||
if current_viewname != foldername:
|
if current_viewname != foldername:
|
||||||
log("viewid: %s new viewname: %s" % (folderid, foldername), 1)
|
log("viewid: %s new viewname: %s" % (folderid, foldername), 1)
|
||||||
tagid = kodi_db.createTag(foldername)
|
tagid = kodi_db.createTag(foldername)
|
||||||
|
|
||||||
# Update view with new info
|
# Update view with new info
|
||||||
emby_db.updateView(foldername, tagid, folderid)
|
emby_db.updateView(foldername, tagid, folderid)
|
||||||
|
|
||||||
|
@ -538,7 +539,7 @@ class LibrarySync(threading.Thread):
|
||||||
sorted_views[sorted_views.index(foldername)] = "%ss" % foldername
|
sorted_views[sorted_views.index(foldername)] = "%ss" % foldername
|
||||||
nodes.append(foldername)
|
nodes.append(foldername)
|
||||||
totalnodes += 1
|
totalnodes += 1
|
||||||
|
|
||||||
# Update items with new tag
|
# Update items with new tag
|
||||||
items = emby_db.getItem_byView(folderid)
|
items = emby_db.getItem_byView(folderid)
|
||||||
for item in items:
|
for item in items:
|
||||||
|
@ -591,7 +592,7 @@ class LibrarySync(threading.Thread):
|
||||||
|
|
||||||
##### PROCESS MOVIES #####
|
##### PROCESS MOVIES #####
|
||||||
for view in views:
|
for view in views:
|
||||||
|
|
||||||
if self.shouldStop():
|
if self.shouldStop():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -617,7 +618,7 @@ class LibrarySync(threading.Thread):
|
||||||
# Process individual movies
|
# Process individual movies
|
||||||
if self.shouldStop():
|
if self.shouldStop():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
title = embymovie['Name']
|
title = embymovie['Name']
|
||||||
if pdialog:
|
if pdialog:
|
||||||
percentage = int((float(count) / float(total))*100)
|
percentage = int((float(count) / float(total))*100)
|
||||||
|
@ -631,11 +632,11 @@ class LibrarySync(threading.Thread):
|
||||||
##### PROCESS BOXSETS #####
|
##### PROCESS BOXSETS #####
|
||||||
if pdialog:
|
if pdialog:
|
||||||
pdialog.update(heading="Emby for Kodi", message=lang(33018))
|
pdialog.update(heading="Emby for Kodi", message=lang(33018))
|
||||||
|
|
||||||
boxsets = emby.getBoxset(dialog=pdialog)
|
boxsets = emby.getBoxset(dialog=pdialog)
|
||||||
total = boxsets['TotalRecordCount']
|
total = boxsets['TotalRecordCount']
|
||||||
embyboxsets = boxsets['Items']
|
embyboxsets = boxsets['Items']
|
||||||
|
|
||||||
if pdialog:
|
if pdialog:
|
||||||
pdialog.update(heading="Processing Boxsets / %s items" % total)
|
pdialog.update(heading="Processing Boxsets / %s items" % total)
|
||||||
|
|
||||||
|
@ -668,7 +669,7 @@ class LibrarySync(threading.Thread):
|
||||||
log("Media folders: %s" % views, 1)
|
log("Media folders: %s" % views, 1)
|
||||||
|
|
||||||
for view in views:
|
for view in views:
|
||||||
|
|
||||||
if self.shouldStop():
|
if self.shouldStop():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -694,7 +695,7 @@ class LibrarySync(threading.Thread):
|
||||||
# Process individual musicvideo
|
# Process individual musicvideo
|
||||||
if self.shouldStop():
|
if self.shouldStop():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
title = embymvideo['Name']
|
title = embymvideo['Name']
|
||||||
if pdialog:
|
if pdialog:
|
||||||
percentage = int((float(count) / float(total))*100)
|
percentage = int((float(count) / float(total))*100)
|
||||||
|
@ -719,7 +720,7 @@ class LibrarySync(threading.Thread):
|
||||||
log("Media folders: %s" % views, 1)
|
log("Media folders: %s" % views, 1)
|
||||||
|
|
||||||
for view in views:
|
for view in views:
|
||||||
|
|
||||||
if self.shouldStop():
|
if self.shouldStop():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -744,7 +745,7 @@ class LibrarySync(threading.Thread):
|
||||||
# Process individual show
|
# Process individual show
|
||||||
if self.shouldStop():
|
if self.shouldStop():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
itemid = embytvshow['Id']
|
itemid = embytvshow['Id']
|
||||||
title = embytvshow['Name']
|
title = embytvshow['Name']
|
||||||
if pdialog:
|
if pdialog:
|
||||||
|
@ -802,7 +803,7 @@ class LibrarySync(threading.Thread):
|
||||||
# Process individual item
|
# Process individual item
|
||||||
if self.shouldStop():
|
if self.shouldStop():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
title = embyitem['Name']
|
title = embyitem['Name']
|
||||||
if pdialog:
|
if pdialog:
|
||||||
percentage = int((float(count) / float(total))*100)
|
percentage = int((float(count) / float(total))*100)
|
||||||
|
@ -836,7 +837,7 @@ class LibrarySync(threading.Thread):
|
||||||
processlist[process].extend(items)
|
processlist[process].extend(items)
|
||||||
|
|
||||||
def incrementalSync(self):
|
def incrementalSync(self):
|
||||||
|
|
||||||
log = self.logMsg
|
log = self.logMsg
|
||||||
|
|
||||||
embyconn = utils.kodiSQL('emby')
|
embyconn = utils.kodiSQL('emby')
|
||||||
|
@ -871,7 +872,7 @@ class LibrarySync(threading.Thread):
|
||||||
for type in types:
|
for type in types:
|
||||||
|
|
||||||
if process[type] and utils.window('emby_kodiScan') != "true":
|
if process[type] and utils.window('emby_kodiScan') != "true":
|
||||||
|
|
||||||
listItems = list(process[type])
|
listItems = list(process[type])
|
||||||
del process[type][:] # Reset class list
|
del process[type][:] # Reset class list
|
||||||
|
|
||||||
|
@ -884,7 +885,7 @@ class LibrarySync(threading.Thread):
|
||||||
|
|
||||||
elif type in ("userdata", "remove"):
|
elif type in ("userdata", "remove"):
|
||||||
items = emby_db.sortby_mediaType(listItems, unsorted=False)
|
items = emby_db.sortby_mediaType(listItems, unsorted=False)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
items = emby_db.sortby_mediaType(listItems)
|
items = emby_db.sortby_mediaType(listItems)
|
||||||
if items.get('Unsorted'):
|
if items.get('Unsorted'):
|
||||||
|
@ -944,7 +945,7 @@ class LibrarySync(threading.Thread):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.run_internal()
|
self.run_internal()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
@ -988,7 +989,7 @@ class LibrarySync(threading.Thread):
|
||||||
if not uptoDate:
|
if not uptoDate:
|
||||||
log("Database version out of date: %s minimum version required: %s"
|
log("Database version out of date: %s minimum version required: %s"
|
||||||
% (currentVersion, minVersion), 0)
|
% (currentVersion, minVersion), 0)
|
||||||
|
|
||||||
resp = dialog.yesno("Emby for Kodi", lang(33022))
|
resp = dialog.yesno("Emby for Kodi", lang(33022))
|
||||||
if not resp:
|
if not resp:
|
||||||
log("Database version is out of date! USER IGNORED!", 0)
|
log("Database version is out of date! USER IGNORED!", 0)
|
||||||
|
@ -1076,7 +1077,7 @@ class ManualSync(LibrarySync):
|
||||||
def sync(self, dialog=False):
|
def sync(self, dialog=False):
|
||||||
|
|
||||||
return self.fullSync(manualrun=True, forceddialog=dialog)
|
return self.fullSync(manualrun=True, forceddialog=dialog)
|
||||||
|
|
||||||
|
|
||||||
def movies(self, embycursor, kodicursor, pdialog):
|
def movies(self, embycursor, kodicursor, pdialog):
|
||||||
|
|
||||||
|
@ -1108,7 +1109,7 @@ class ManualSync(LibrarySync):
|
||||||
|
|
||||||
##### PROCESS MOVIES #####
|
##### PROCESS MOVIES #####
|
||||||
for view in views:
|
for view in views:
|
||||||
|
|
||||||
if self.shouldStop():
|
if self.shouldStop():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -1131,7 +1132,7 @@ class ManualSync(LibrarySync):
|
||||||
itemid = embymovie['Id']
|
itemid = embymovie['Id']
|
||||||
all_embymoviesIds.add(itemid)
|
all_embymoviesIds.add(itemid)
|
||||||
|
|
||||||
|
|
||||||
if all_kodimovies.get(itemid) != API.getChecksum():
|
if all_kodimovies.get(itemid) != API.getChecksum():
|
||||||
# Only update if movie is not in Kodi or checksum is different
|
# Only update if movie is not in Kodi or checksum is different
|
||||||
updatelist.append(itemid)
|
updatelist.append(itemid)
|
||||||
|
@ -1149,7 +1150,7 @@ class ManualSync(LibrarySync):
|
||||||
# Process individual movies
|
# Process individual movies
|
||||||
if self.shouldStop():
|
if self.shouldStop():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
title = embymovie['Name']
|
title = embymovie['Name']
|
||||||
if pdialog:
|
if pdialog:
|
||||||
percentage = int((float(count) / float(total))*100)
|
percentage = int((float(count) / float(total))*100)
|
||||||
|
@ -1158,7 +1159,7 @@ class ManualSync(LibrarySync):
|
||||||
movies.add_update(embymovie, viewName, viewId)
|
movies.add_update(embymovie, viewName, viewId)
|
||||||
|
|
||||||
##### PROCESS BOXSETS #####
|
##### PROCESS BOXSETS #####
|
||||||
|
|
||||||
boxsets = emby.getBoxset(dialog=pdialog)
|
boxsets = emby.getBoxset(dialog=pdialog)
|
||||||
embyboxsets = []
|
embyboxsets = []
|
||||||
|
|
||||||
|
@ -1182,7 +1183,7 @@ class ManualSync(LibrarySync):
|
||||||
|
|
||||||
log("Boxsets to update: %s" % updatelist, 1)
|
log("Boxsets to update: %s" % updatelist, 1)
|
||||||
total = len(updatelist)
|
total = len(updatelist)
|
||||||
|
|
||||||
if pdialog:
|
if pdialog:
|
||||||
pdialog.update(heading="Processing Boxsets / %s items" % total)
|
pdialog.update(heading="Processing Boxsets / %s items" % total)
|
||||||
|
|
||||||
|
@ -1236,7 +1237,7 @@ class ManualSync(LibrarySync):
|
||||||
updatelist = []
|
updatelist = []
|
||||||
|
|
||||||
for view in views:
|
for view in views:
|
||||||
|
|
||||||
if self.shouldStop():
|
if self.shouldStop():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -1259,7 +1260,7 @@ class ManualSync(LibrarySync):
|
||||||
itemid = embymvideo['Id']
|
itemid = embymvideo['Id']
|
||||||
all_embymvideosIds.add(itemid)
|
all_embymvideosIds.add(itemid)
|
||||||
|
|
||||||
|
|
||||||
if all_kodimvideos.get(itemid) != API.getChecksum():
|
if all_kodimvideos.get(itemid) != API.getChecksum():
|
||||||
# Only update if musicvideo is not in Kodi or checksum is different
|
# Only update if musicvideo is not in Kodi or checksum is different
|
||||||
updatelist.append(itemid)
|
updatelist.append(itemid)
|
||||||
|
@ -1278,14 +1279,14 @@ class ManualSync(LibrarySync):
|
||||||
# Process individual musicvideo
|
# Process individual musicvideo
|
||||||
if self.shouldStop():
|
if self.shouldStop():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
title = embymvideo['Name']
|
title = embymvideo['Name']
|
||||||
if pdialog:
|
if pdialog:
|
||||||
percentage = int((float(count) / float(total))*100)
|
percentage = int((float(count) / float(total))*100)
|
||||||
pdialog.update(percentage, message=title)
|
pdialog.update(percentage, message=title)
|
||||||
count += 1
|
count += 1
|
||||||
mvideos.add_update(embymvideo, viewName, viewId)
|
mvideos.add_update(embymvideo, viewName, viewId)
|
||||||
|
|
||||||
##### PROCESS DELETES #####
|
##### PROCESS DELETES #####
|
||||||
|
|
||||||
for kodimvideo in all_kodimvideos:
|
for kodimvideo in all_kodimvideos:
|
||||||
|
@ -1326,7 +1327,7 @@ class ManualSync(LibrarySync):
|
||||||
|
|
||||||
|
|
||||||
for view in views:
|
for view in views:
|
||||||
|
|
||||||
if self.shouldStop():
|
if self.shouldStop():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -1349,7 +1350,7 @@ class ManualSync(LibrarySync):
|
||||||
itemid = embytvshow['Id']
|
itemid = embytvshow['Id']
|
||||||
all_embytvshowsIds.add(itemid)
|
all_embytvshowsIds.add(itemid)
|
||||||
|
|
||||||
|
|
||||||
if all_koditvshows.get(itemid) != API.getChecksum():
|
if all_koditvshows.get(itemid) != API.getChecksum():
|
||||||
# Only update if movie is not in Kodi or checksum is different
|
# Only update if movie is not in Kodi or checksum is different
|
||||||
updatelist.append(itemid)
|
updatelist.append(itemid)
|
||||||
|
@ -1368,7 +1369,7 @@ class ManualSync(LibrarySync):
|
||||||
# Process individual show
|
# Process individual show
|
||||||
if self.shouldStop():
|
if self.shouldStop():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
itemid = embytvshow['Id']
|
itemid = embytvshow['Id']
|
||||||
title = embytvshow['Name']
|
title = embytvshow['Name']
|
||||||
if pdialog:
|
if pdialog:
|
||||||
|
@ -1408,7 +1409,7 @@ class ManualSync(LibrarySync):
|
||||||
|
|
||||||
# Process individual episode
|
# Process individual episode
|
||||||
if self.shouldStop():
|
if self.shouldStop():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
title = episode['SeriesName']
|
title = episode['SeriesName']
|
||||||
episodetitle = episode['Name']
|
episodetitle = episode['Name']
|
||||||
|
@ -1417,7 +1418,7 @@ class ManualSync(LibrarySync):
|
||||||
pdialog.update(percentage, message="%s - %s" % (title, episodetitle))
|
pdialog.update(percentage, message="%s - %s" % (title, episodetitle))
|
||||||
count += 1
|
count += 1
|
||||||
tvshows.add_updateEpisode(episode)
|
tvshows.add_updateEpisode(episode)
|
||||||
|
|
||||||
##### PROCESS DELETES #####
|
##### PROCESS DELETES #####
|
||||||
|
|
||||||
for koditvshow in all_koditvshows:
|
for koditvshow in all_koditvshows:
|
||||||
|
@ -1517,7 +1518,7 @@ class ManualSync(LibrarySync):
|
||||||
# Process individual item
|
# Process individual item
|
||||||
if self.shouldStop():
|
if self.shouldStop():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
title = embyitem['Name']
|
title = embyitem['Name']
|
||||||
if pdialog:
|
if pdialog:
|
||||||
percentage = int((float(count) / float(total))*100)
|
percentage = int((float(count) / float(total))*100)
|
||||||
|
|
Loading…
Reference in a new issue