Do background sync while playing
But no full sync
This commit is contained in:
parent
9037f65318
commit
9dec68f6d9
4 changed files with 12 additions and 8 deletions
|
@ -1573,7 +1573,7 @@ class API():
|
||||||
except:
|
except:
|
||||||
lastPlayedDate = None
|
lastPlayedDate = None
|
||||||
|
|
||||||
userrating = int(item.get('userRating', 0))
|
userrating = int(float(item.get('userRating', 0)))
|
||||||
|
|
||||||
resume, runtime = self.getRuntime()
|
resume, runtime = self.getRuntime()
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1449,6 +1449,8 @@ class LibrarySync(Thread):
|
||||||
fullSyncInterval = self.fullSyncInterval
|
fullSyncInterval = self.fullSyncInterval
|
||||||
lastProcessing = 0
|
lastProcessing = 0
|
||||||
|
|
||||||
|
xbmcplayer = xbmc.Player()
|
||||||
|
|
||||||
dialog = xbmcgui.Dialog()
|
dialog = xbmcgui.Dialog()
|
||||||
|
|
||||||
queue = self.queue
|
queue = self.queue
|
||||||
|
@ -1569,7 +1571,8 @@ class LibrarySync(Thread):
|
||||||
window('emby_dbScan', clear=True)
|
window('emby_dbScan', clear=True)
|
||||||
else:
|
else:
|
||||||
now = utils.getUnixTimestamp()
|
now = utils.getUnixTimestamp()
|
||||||
if now - self.lastSync > fullSyncInterval:
|
if (now - self.lastSync > fullSyncInterval and
|
||||||
|
not xbmcplayer.isPlaying()):
|
||||||
log('Doing scheduled full library scan', 1)
|
log('Doing scheduled full library scan', 1)
|
||||||
# Recalculate time offset Kodi - PMS
|
# Recalculate time offset Kodi - PMS
|
||||||
self.syncPMStime()
|
self.syncPMStime()
|
||||||
|
@ -1589,7 +1592,6 @@ class LibrarySync(Thread):
|
||||||
# See if there is a PMS message we need to handle
|
# See if there is a PMS message we need to handle
|
||||||
try:
|
try:
|
||||||
message = queue.get(block=False)
|
message = queue.get(block=False)
|
||||||
# Empty queue
|
|
||||||
except Queue.Empty:
|
except Queue.Empty:
|
||||||
xbmc.sleep(100)
|
xbmc.sleep(100)
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -110,10 +110,6 @@ class Player(xbmc.Player):
|
||||||
window('emby_skipWatched%s' % itemId, value="true")
|
window('emby_skipWatched%s' % itemId, value="true")
|
||||||
|
|
||||||
log("Playing itemtype is: %s" % itemType, 1)
|
log("Playing itemtype is: %s" % itemType, 1)
|
||||||
# Suspend library sync thread while movie is playing
|
|
||||||
if itemType in ('movie', 'episode'):
|
|
||||||
log("Suspending library sync while playing", 1)
|
|
||||||
window('suspend_LibraryThread', value='true')
|
|
||||||
|
|
||||||
customseek = window('emby_customPlaylist.seektime')
|
customseek = window('emby_customPlaylist.seektime')
|
||||||
if (window('emby_customPlaylist') == "true" and customseek):
|
if (window('emby_customPlaylist') == "true" and customseek):
|
||||||
|
@ -459,7 +455,6 @@ class Player(xbmc.Player):
|
||||||
window('emby_customPlaylist', clear=True)
|
window('emby_customPlaylist', clear=True)
|
||||||
window('emby_customPlaylist.seektime', clear=True)
|
window('emby_customPlaylist.seektime', clear=True)
|
||||||
window('emby_playbackProps', clear=True)
|
window('emby_playbackProps', clear=True)
|
||||||
window('suspend_LibraryThread', clear=True)
|
|
||||||
window('emby_customPlaylist.seektime', clear=True)
|
window('emby_customPlaylist.seektime', clear=True)
|
||||||
log("Clear playlist properties.", 1)
|
log("Clear playlist properties.", 1)
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ import utils
|
||||||
|
|
||||||
|
|
||||||
@utils.logging
|
@utils.logging
|
||||||
|
@utils.ThreadMethodsAdditionalSuspend('suspend_LibraryThread')
|
||||||
@utils.ThreadMethods
|
@utils.ThreadMethods
|
||||||
class WebSocket(threading.Thread):
|
class WebSocket(threading.Thread):
|
||||||
opcode_data = (websocket.ABNF.OPCODE_TEXT, websocket.ABNF.OPCODE_BINARY)
|
opcode_data = (websocket.ABNF.OPCODE_TEXT, websocket.ABNF.OPCODE_BINARY)
|
||||||
|
@ -103,6 +104,12 @@ class WebSocket(threading.Thread):
|
||||||
# In the event the server goes offline
|
# In the event the server goes offline
|
||||||
while threadSuspended():
|
while threadSuspended():
|
||||||
# Set in service.py
|
# Set in service.py
|
||||||
|
if self.ws is not None:
|
||||||
|
try:
|
||||||
|
self.ws.shutdown()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
self.ws = None
|
||||||
if threadStopped():
|
if threadStopped():
|
||||||
# Abort was requested while waiting. We should exit
|
# Abort was requested while waiting. We should exit
|
||||||
log("##===---- WebSocketClient Stopped ----===##", 0)
|
log("##===---- WebSocketClient Stopped ----===##", 0)
|
||||||
|
|
Loading…
Reference in a new issue