Fix crash when Kodi not playing as expected

Fixes #41
This commit is contained in:
tomkat83 2016-05-31 19:02:11 +02:00
parent a92146abc2
commit a7832b5ceb

View file

@ -111,7 +111,10 @@ class Player(xbmc.Player):
self.xbmcplayer.seekTime(int(customseek))
window('plex_customplaylist.seektime', clear=True)
seekTime = self.xbmcplayer.getTime()
try:
seekTime = self.xbmcplayer.getTime()
except RuntimeError:
seekTime = 0
# Get playback volume
volume_query = {
@ -419,7 +422,6 @@ class Player(xbmc.Player):
if self.played_info.get(currentFile):
self.played_info[currentFile]['paused'] = True
self.reportPlayback()
def onPlayBackResumed(self):
@ -429,7 +431,6 @@ class Player(xbmc.Player):
if self.played_info.get(currentFile):
self.played_info[currentFile]['paused'] = False
self.reportPlayback()
def onPlayBackSeek(self, time, seekOffset):
@ -438,11 +439,14 @@ class Player(xbmc.Player):
self.logMsg("PLAYBACK_SEEK: %s" % utils.tryDecode(currentFile), 2)
if self.played_info.get(currentFile):
position = self.xbmcplayer.getTime()
try:
position = self.xbmcplayer.getTime()
except RuntimeError:
# When Kodi is not playing
return
self.played_info[currentFile]['currentPosition'] = position * 1000
self.reportPlayback()
def onPlayBackStopped(self):
# Will be called when user stops xbmc playing a file