mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 02:06:09 +00:00
-retry start() on threads as slow systems can sometimes take a few seconds to release old threads
-check json parsing for errros and return -if no runtime then use zero
This commit is contained in:
parent
4298db5f90
commit
00edbf610b
3 changed files with 29 additions and 7 deletions
|
@ -64,8 +64,12 @@ class KodiMonitor(xbmc.Monitor):
|
|||
if method not in ('Playlist.OnAdd', 'Player.OnStop', 'Player.OnClear'):
|
||||
log.info("Method: %s Data: %s", method, data)
|
||||
|
||||
if data:
|
||||
data = json.loads(data, 'utf-8')
|
||||
try:
|
||||
if data:
|
||||
data = json.loads(data, 'utf-8')
|
||||
except:
|
||||
log.info("Error parsing message data: %s", data)
|
||||
return
|
||||
|
||||
if method == 'Player.OnPlay':
|
||||
self._on_play_(data)
|
||||
|
|
|
@ -215,8 +215,12 @@ class Player(xbmc.Player):
|
|||
try:
|
||||
runtime = int(runtime)
|
||||
except ValueError:
|
||||
runtime = self.xbmcplayer.getTotalTime()
|
||||
log.info("Runtime is missing, Kodi runtime: %s" % runtime)
|
||||
try:
|
||||
runtime = int(self.xbmcplayer.getTotalTime())
|
||||
log.info("Runtime is missing, Kodi runtime: %s" % runtime)
|
||||
except:
|
||||
runtime = 0
|
||||
log.info("Runtime is missing, Using Zero")
|
||||
|
||||
# Save data map for updates and position calls
|
||||
data = {
|
||||
|
|
|
@ -82,9 +82,23 @@ class Read_EmbyServer():
|
|||
if len(self.download_threads) < self.download_limit:
|
||||
# Start new "daemon thread" - actual daemon thread is not supported in Kodi
|
||||
new_thread = DownloadThreader(queue, output)
|
||||
new_thread.start()
|
||||
self.download_threads.append(new_thread)
|
||||
return True
|
||||
|
||||
counter = 0
|
||||
worked = False
|
||||
while counter < 10:
|
||||
try:
|
||||
new_thread.start()
|
||||
worked = True
|
||||
break
|
||||
except:
|
||||
counter = counter + 1
|
||||
xbmc.sleep(1000)
|
||||
|
||||
if worked:
|
||||
self.download_threads.append(new_thread)
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
else:
|
||||
log.info("Waiting for empty download spot: %s", len(self.download_threads))
|
||||
xbmc.sleep(100)
|
||||
|
|
Loading…
Reference in a new issue