mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-24 17:56:11 +00:00
Don't use incremental sync on first run
This commit is contained in:
parent
327d790095
commit
084d1fb493
1 changed files with 11 additions and 7 deletions
|
@ -67,7 +67,7 @@ class LibrarySync(threading.Thread):
|
||||||
dbSyncIndication = addon.getSetting("dbSyncIndication") == "true"
|
dbSyncIndication = addon.getSetting("dbSyncIndication") == "true"
|
||||||
|
|
||||||
# just do a incremental sync if that is what is required
|
# just do a incremental sync if that is what is required
|
||||||
if(addon.getSetting("useIncSync") == "true"):
|
if(addon.getSetting("useIncSync") == "true" and addon.getSetting("SyncInstallRunDone") == "true") :
|
||||||
utils.logMsg("Sync Database", "Using incremental sync instead of full sync useIncSync=True)", 0)
|
utils.logMsg("Sync Database", "Using incremental sync instead of full sync useIncSync=True)", 0)
|
||||||
|
|
||||||
du = DownloadUtils()
|
du = DownloadUtils()
|
||||||
|
@ -81,7 +81,7 @@ class LibrarySync(threading.Thread):
|
||||||
utils.logMsg("Sync Database", "Incremental Sync Get Items URL : " + url, 0)
|
utils.logMsg("Sync Database", "Incremental Sync Get Items URL : " + url, 0)
|
||||||
|
|
||||||
results = du.downloadUrl(url)
|
results = du.downloadUrl(url)
|
||||||
utils.logMsg("Sync Database", "Incfemental 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"]
|
||||||
|
@ -93,10 +93,7 @@ class LibrarySync(threading.Thread):
|
||||||
LibrarySync().update_items(changedItems)
|
LibrarySync().update_items(changedItems)
|
||||||
LibrarySync().user_data_update(userChanges)
|
LibrarySync().user_data_update(userChanges)
|
||||||
|
|
||||||
# save last sync time
|
self.SaveLastSync()
|
||||||
lastSync = (datetime.utcnow() - timedelta(minutes=5)).strftime('%Y-%m-%dT%H:%M:%SZ')
|
|
||||||
utils.logMsg("Sync Database", "Incremental Sync Setting Last Run Time Saved : " + lastSync, 0)
|
|
||||||
addon.setSetting("LastIncrenetalSync", lastSync)
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -171,6 +168,7 @@ class LibrarySync(threading.Thread):
|
||||||
if(syncInstallRunDone == False and completed):
|
if(syncInstallRunDone == False and completed):
|
||||||
addon = xbmcaddon.Addon(id='plugin.video.emby') #force a new instance of the addon
|
addon = xbmcaddon.Addon(id='plugin.video.emby') #force a new instance of the addon
|
||||||
addon.setSetting("SyncInstallRunDone", "true")
|
addon.setSetting("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)")
|
||||||
|
@ -190,7 +188,13 @@ class LibrarySync(threading.Thread):
|
||||||
pDialog.close()
|
pDialog.close()
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
def SaveLastSync(self):
|
||||||
|
# save last sync time
|
||||||
|
addon = xbmcaddon.Addon(id='plugin.video.emby')
|
||||||
|
lastSync = (datetime.utcnow() - timedelta(minutes=5)).strftime('%Y-%m-%dT%H:%M:%SZ')
|
||||||
|
utils.logMsg("Sync Database", "Incremental Sync Setting Last Run Time Saved : " + lastSync, 0)
|
||||||
|
addon.setSetting("LastIncrenetalSync", lastSync)
|
||||||
|
|
||||||
def MoviesFullSync(self,connection,cursor, pDialog):
|
def MoviesFullSync(self,connection,cursor, pDialog):
|
||||||
|
|
||||||
views = ReadEmbyDB().getCollections("movies")
|
views = ReadEmbyDB().getCollections("movies")
|
||||||
|
|
Loading…
Reference in a new issue