user server time, add max items setting
This commit is contained in:
parent
5a5ff2871c
commit
2b9e352d72
3 changed files with 21 additions and 5 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.36"
|
version="1.1.37"
|
||||||
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"/>
|
||||||
|
|
|
@ -98,8 +98,9 @@ class LibrarySync(threading.Thread):
|
||||||
utils.logMsg("Sync Database", "Incremental Sync Get Changes Failed", 0)
|
utils.logMsg("Sync Database", "Incremental Sync Get Changes Failed", 0)
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
maxItems = int(utils.settings("incSyncMaxItems"))
|
||||||
utils.logMsg("Sync Database", "Incremental Sync Changes : " + str(results), 0)
|
utils.logMsg("Sync Database", "Incremental Sync Changes : " + str(results), 0)
|
||||||
if(len(changedItems) < 1000 and len(removedItems) < 1000 and len(userChanges) < 1000):
|
if(len(changedItems) < maxItems and len(removedItems) < maxItems and len(userChanges) < maxItems):
|
||||||
|
|
||||||
WINDOW.setProperty("startup", "done")
|
WINDOW.setProperty("startup", "done")
|
||||||
|
|
||||||
|
@ -111,7 +112,7 @@ class LibrarySync(threading.Thread):
|
||||||
|
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
utils.logMsg("Sync Database", "Too Many For Incremental Sync, changedItems" + str(len(changedItems)) + " removedItems:" + str(len(removedItems)) + " userChanges:" + str(len(userChanges)), 0)
|
utils.logMsg("Sync Database", "Too Many For Incremental Sync (" + str(maxItems) + "), 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")
|
||||||
|
@ -203,8 +204,22 @@ class LibrarySync(threading.Thread):
|
||||||
|
|
||||||
def SaveLastSync(self):
|
def SaveLastSync(self):
|
||||||
# save last sync time
|
# save last sync time
|
||||||
|
|
||||||
|
du = DownloadUtils()
|
||||||
|
url = "{server}/Emby.Kodi.SyncQueue/GetServerDateTime?format=json"
|
||||||
|
|
||||||
|
try:
|
||||||
|
results = du.downloadUrl(url)
|
||||||
|
lastSync = results["ServerDateTime"]
|
||||||
|
self.logMsg("Sync Database, Incremental Sync Using Server Time: %s" % lastSync, 0)
|
||||||
|
lastSync = datetime.strptime(lastSync, "%Y-%m-%dT%H:%M:%SZ")
|
||||||
|
lastSync = (lastSync - timedelta(minutes=5)).strftime('%Y-%m-%dT%H:%M:%SZ')
|
||||||
|
self.logMsg("Sync Database, Incremental Sync Using Server Time -5 min: %s" % lastSync, 0)
|
||||||
|
except:
|
||||||
lastSync = (datetime.utcnow() - timedelta(minutes=5)).strftime('%Y-%m-%dT%H:%M:%SZ')
|
lastSync = (datetime.utcnow() - timedelta(minutes=5)).strftime('%Y-%m-%dT%H:%M:%SZ')
|
||||||
self.logMsg("Sync Database, Incremental Sync Setting Last Run Time Saved: %s" % lastSync, 1)
|
self.logMsg("Sync Database, Incremental Sync Using Client Time -5 min: %s" % lastSync, 0)
|
||||||
|
|
||||||
|
self.logMsg("Sync Database, Incremental Sync Setting Last Run Time Saved: %s" % lastSync, 0)
|
||||||
utils.settings("LastIncrenetalSync", lastSync)
|
utils.settings("LastIncrenetalSync", lastSync)
|
||||||
|
|
||||||
def MoviesFullSync(self,connection, cursor, pDialog):
|
def MoviesFullSync(self,connection, cursor, pDialog):
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
<setting id="useDirectPaths" type="bool" label="30250" default="false" visible="true" enable="true" />
|
<setting id="useDirectPaths" type="bool" label="30250" default="false" visible="true" enable="true" />
|
||||||
<setting id="enableTextureCache" type="bool" label="Auto add images to the Kodi texture cache" default="true" visible="true" enable="true" />
|
<setting id="enableTextureCache" type="bool" label="Auto add images to the Kodi texture cache" default="true" visible="true" enable="true" />
|
||||||
<setting id="useIncSync" type="bool" label="Use incremental sync at startup (Requires Server Plugin)" default="false" visible="true" enable="true" />
|
<setting id="useIncSync" type="bool" label="Use incremental sync at startup (Requires Server Plugin)" default="false" visible="true" enable="true" />
|
||||||
|
<setting id="incSyncMaxItems" type="number" label=" - Max change set size" default="1000" visible="eq(-1,true)" enable="true" />
|
||||||
</category>
|
</category>
|
||||||
<category label="Playback"> <!-- Extra Sync options -->
|
<category label="Playback"> <!-- Extra Sync options -->
|
||||||
<setting id="smbusername" type="text" label="30007" default="" visible="true" enable="true" />
|
<setting id="smbusername" type="text" label="30007" default="" visible="true" enable="true" />
|
||||||
|
|
Loading…
Reference in a new issue