mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-26 02:36:10 +00:00
Base fast sync on server time
Try to fix music video refresh to prevent cursor from moving up.
This commit is contained in:
parent
6e601b9061
commit
0f38ab9e3d
2 changed files with 8 additions and 8 deletions
|
@ -160,6 +160,7 @@ class HTTP(object):
|
||||||
|
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
|
self.config['server-time'] = r.headers['Date']
|
||||||
elapsed = int(r.elapsed.total_seconds() * 1000)
|
elapsed = int(r.elapsed.total_seconds() * 1000)
|
||||||
response = r.json()
|
response = r.json()
|
||||||
LOG.debug("---<[ http ][%s ms]", elapsed)
|
LOG.debug("---<[ http ][%s ms]", elapsed)
|
||||||
|
|
|
@ -180,14 +180,11 @@ class Library(threading.Thread):
|
||||||
not self.writer_threads['userdata'] and not self.writer_threads['removed']):
|
not self.writer_threads['userdata'] and not self.writer_threads['removed']):
|
||||||
self.pending_refresh = False
|
self.pending_refresh = False
|
||||||
self.save_last_sync()
|
self.save_last_sync()
|
||||||
xbmc.executebuiltin('UpdateLibrary(video)')
|
|
||||||
|
|
||||||
"""
|
if xbmc.getCondVisibility('Container.Content(musicvideos)'): # Prevent cursor from moving
|
||||||
if xbmc.getCondVisibility('Window.IsActive(home)'):
|
|
||||||
xbmc.executebuiltin('UpdateLibrary(video)')
|
|
||||||
else:
|
|
||||||
xbmc.executebuiltin('Container.Refresh')
|
xbmc.executebuiltin('Container.Refresh')
|
||||||
"""
|
else:
|
||||||
|
xbmc.executebuiltin('UpdateLibrary(video)')
|
||||||
|
|
||||||
def stop_client(self):
|
def stop_client(self):
|
||||||
self.stop_thread = True
|
self.stop_thread = True
|
||||||
|
@ -218,6 +215,8 @@ class Library(threading.Thread):
|
||||||
dialog("ok", heading="{emby}", line1=_(33128))
|
dialog("ok", heading="{emby}", line1=_(33128))
|
||||||
|
|
||||||
raise Exception("Failed to retrieve latest updates")
|
raise Exception("Failed to retrieve latest updates")
|
||||||
|
|
||||||
|
LOG.info("--<[ retrieve changes ]")
|
||||||
else:
|
else:
|
||||||
FullSync(self)
|
FullSync(self)
|
||||||
Views().get_nodes()
|
Views().get_nodes()
|
||||||
|
@ -297,7 +296,7 @@ class Library(threading.Thread):
|
||||||
|
|
||||||
def save_last_sync(self):
|
def save_last_sync(self):
|
||||||
|
|
||||||
time_now = datetime.utcnow() - timedelta(minutes=2)
|
time_now = datetime.strptime(self.server['config/server-time'].split(', ', 1)[1], '%d %b %Y %H:%M:%S GMT') - timedelta(minutes=2)
|
||||||
last_sync = time_now.strftime('%Y-%m-%dT%H:%M:%Sz')
|
last_sync = time_now.strftime('%Y-%m-%dT%H:%M:%Sz')
|
||||||
settings('LastIncrementalSync', value=last_sync)
|
settings('LastIncrementalSync', value=last_sync)
|
||||||
LOG.info("--[ sync/%s ]", last_sync)
|
LOG.info("--[ sync/%s ]", last_sync)
|
||||||
|
|
Loading…
Reference in a new issue