mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +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'):
|
if method not in ('Playlist.OnAdd', 'Player.OnStop', 'Player.OnClear'):
|
||||||
log.info("Method: %s Data: %s", method, data)
|
log.info("Method: %s Data: %s", method, data)
|
||||||
|
|
||||||
if data:
|
try:
|
||||||
data = json.loads(data, 'utf-8')
|
if data:
|
||||||
|
data = json.loads(data, 'utf-8')
|
||||||
|
except:
|
||||||
|
log.info("Error parsing message data: %s", data)
|
||||||
|
return
|
||||||
|
|
||||||
if method == 'Player.OnPlay':
|
if method == 'Player.OnPlay':
|
||||||
self._on_play_(data)
|
self._on_play_(data)
|
||||||
|
|
|
@ -215,8 +215,12 @@ class Player(xbmc.Player):
|
||||||
try:
|
try:
|
||||||
runtime = int(runtime)
|
runtime = int(runtime)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
runtime = self.xbmcplayer.getTotalTime()
|
try:
|
||||||
log.info("Runtime is missing, Kodi runtime: %s" % runtime)
|
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
|
# Save data map for updates and position calls
|
||||||
data = {
|
data = {
|
||||||
|
|
|
@ -82,9 +82,23 @@ class Read_EmbyServer():
|
||||||
if len(self.download_threads) < self.download_limit:
|
if len(self.download_threads) < self.download_limit:
|
||||||
# Start new "daemon thread" - actual daemon thread is not supported in Kodi
|
# Start new "daemon thread" - actual daemon thread is not supported in Kodi
|
||||||
new_thread = DownloadThreader(queue, output)
|
new_thread = DownloadThreader(queue, output)
|
||||||
new_thread.start()
|
|
||||||
self.download_threads.append(new_thread)
|
counter = 0
|
||||||
return True
|
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:
|
else:
|
||||||
log.info("Waiting for empty download spot: %s", len(self.download_threads))
|
log.info("Waiting for empty download spot: %s", len(self.download_threads))
|
||||||
xbmc.sleep(100)
|
xbmc.sleep(100)
|
||||||
|
|
Loading…
Reference in a new issue