mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-27 03:06:10 +00:00
ad some limits to the inc sync counts atm its 1K
This commit is contained in:
parent
30ea23aea0
commit
53cc2c9c74
2 changed files with 35 additions and 27 deletions
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
<addon id="plugin.video.emby"
|
<addon id="plugin.video.emby"
|
||||||
name="Emby"
|
name="Emby"
|
||||||
version="1.1.35"
|
version="1.1.36"
|
||||||
provider-name="Emby.media">
|
provider-name="Emby.media">
|
||||||
<requires>
|
<requires>
|
||||||
<import addon="xbmc.python" version="2.1.0"/>
|
<import addon="xbmc.python" version="2.1.0"/>
|
||||||
|
|
|
@ -89,13 +89,20 @@ class LibrarySync(threading.Thread):
|
||||||
url = "{server}/Emby.Kodi.SyncQueue/{UserId}/GetItems?LastUpdateDT=" + lastSync + "&format=json"
|
url = "{server}/Emby.Kodi.SyncQueue/{UserId}/GetItems?LastUpdateDT=" + lastSync + "&format=json"
|
||||||
utils.logMsg("Sync Database", "Incremental Sync Get Items URL : " + url, 0)
|
utils.logMsg("Sync Database", "Incremental Sync Get Items URL : " + url, 0)
|
||||||
|
|
||||||
|
try:
|
||||||
results = du.downloadUrl(url)
|
results = du.downloadUrl(url)
|
||||||
|
except:
|
||||||
|
utils.logMsg("Sync Database", "Incremental Sync Get Changes Failed", 0)
|
||||||
|
pass
|
||||||
|
else:
|
||||||
utils.logMsg("Sync Database", "Incremental Sync Changes : " + str(results), 0)
|
utils.logMsg("Sync Database", "Incremental Sync Changes : " + str(results), 0)
|
||||||
|
|
||||||
changedItems = results["ItemsUpdated"] + results["ItemsAdded"]
|
changedItems = results["ItemsUpdated"] + results["ItemsAdded"]
|
||||||
removedItems = results["ItemsRemoved"]
|
removedItems = results["ItemsRemoved"]
|
||||||
userChanges = results["UserDataChanged"]
|
userChanges = results["UserDataChanged"]
|
||||||
|
|
||||||
|
if(len(changedItems) < 1000 and len(removedItems) < 1000 and len(userChanges) < 1000):
|
||||||
|
|
||||||
WINDOW.setProperty("startup", "done")
|
WINDOW.setProperty("startup", "done")
|
||||||
|
|
||||||
LibrarySync().remove_items(removedItems)
|
LibrarySync().remove_items(removedItems)
|
||||||
|
@ -105,6 +112,8 @@ class LibrarySync(threading.Thread):
|
||||||
self.SaveLastSync()
|
self.SaveLastSync()
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
else:
|
||||||
|
utils.logMsg("Sync Database", "Too Many For Incremental Sync, changedItems" + str(len(changedItems)) + " removedItems:" + str(len(removedItems)) + " userChanges:" + str(len(userChanges)), 0)
|
||||||
|
|
||||||
#set some variable to check if this is the first run
|
#set some variable to check if this is the first run
|
||||||
WINDOW.setProperty("SyncDatabaseRunning", "true")
|
WINDOW.setProperty("SyncDatabaseRunning", "true")
|
||||||
|
@ -172,7 +181,6 @@ class LibrarySync(threading.Thread):
|
||||||
# set the install done setting
|
# set the install done setting
|
||||||
if(syncInstallRunDone == False and completed):
|
if(syncInstallRunDone == False and completed):
|
||||||
utils.settings("SyncInstallRunDone", "true")
|
utils.settings("SyncInstallRunDone", "true")
|
||||||
self.SaveLastSync()
|
|
||||||
|
|
||||||
# Commit all DB changes at once and Force refresh the library
|
# Commit all DB changes at once and Force refresh the library
|
||||||
xbmc.executebuiltin("UpdateLibrary(video)")
|
xbmc.executebuiltin("UpdateLibrary(video)")
|
||||||
|
@ -184,11 +192,12 @@ class LibrarySync(threading.Thread):
|
||||||
# tell any widgets to refresh because the content has changed
|
# tell any widgets to refresh because the content has changed
|
||||||
WINDOW.setProperty("widgetreload", datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
|
WINDOW.setProperty("widgetreload", datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
|
||||||
|
|
||||||
|
self.SaveLastSync()
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
WINDOW.setProperty("SyncDatabaseRunning", "false")
|
WINDOW.setProperty("SyncDatabaseRunning", "false")
|
||||||
utils.logMsg("Sync DB", "syncDatabase Exiting", 0)
|
utils.logMsg("Sync DB", "syncDatabase Exiting", 0)
|
||||||
|
|
||||||
|
|
||||||
if(pDialog != None):
|
if(pDialog != None):
|
||||||
pDialog.close()
|
pDialog.close()
|
||||||
|
|
||||||
|
@ -247,15 +256,14 @@ class LibrarySync(threading.Thread):
|
||||||
|
|
||||||
|
|
||||||
#### PROCESS BOX SETS #####
|
#### PROCESS BOX SETS #####
|
||||||
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
|
||||||
count = 1
|
count = 1
|
||||||
for boxset in boxsets:
|
for boxset in boxsets:
|
||||||
progressTitle = "Processing BoxSets"+ " (" + str(count) + " of " + str(total) + ")"
|
if(pDialog != None):
|
||||||
|
progressTitle = "Processing BoxSets" + " (" + str(count) + " of " + str(total-1) + ")"
|
||||||
percentage = int(((float(count) / float(total)) * 100))
|
percentage = int(((float(count) / float(total)) * 100))
|
||||||
pDialog.update(percentage, "Emby for Kodi - Running Sync", progressTitle)
|
pDialog.update(percentage, "Emby for Kodi - Running Sync", progressTitle)
|
||||||
count += 1
|
count += 1
|
||||||
|
|
Loading…
Reference in a new issue