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)) self.xbmcplayer.seekTime(int(customseek))
window('plex_customplaylist.seektime', clear=True) window('plex_customplaylist.seektime', clear=True)
try:
seekTime = self.xbmcplayer.getTime() seekTime = self.xbmcplayer.getTime()
except RuntimeError:
seekTime = 0
# Get playback volume # Get playback volume
volume_query = { volume_query = {
@ -419,7 +422,6 @@ class Player(xbmc.Player):
if self.played_info.get(currentFile): if self.played_info.get(currentFile):
self.played_info[currentFile]['paused'] = True self.played_info[currentFile]['paused'] = True
self.reportPlayback() self.reportPlayback()
def onPlayBackResumed(self): def onPlayBackResumed(self):
@ -429,7 +431,6 @@ class Player(xbmc.Player):
if self.played_info.get(currentFile): if self.played_info.get(currentFile):
self.played_info[currentFile]['paused'] = False self.played_info[currentFile]['paused'] = False
self.reportPlayback() self.reportPlayback()
def onPlayBackSeek(self, time, seekOffset): def onPlayBackSeek(self, time, seekOffset):
@ -438,9 +439,12 @@ class Player(xbmc.Player):
self.logMsg("PLAYBACK_SEEK: %s" % utils.tryDecode(currentFile), 2) self.logMsg("PLAYBACK_SEEK: %s" % utils.tryDecode(currentFile), 2)
if self.played_info.get(currentFile): if self.played_info.get(currentFile):
try:
position = self.xbmcplayer.getTime() position = self.xbmcplayer.getTime()
except RuntimeError:
# When Kodi is not playing
return
self.played_info[currentFile]['currentPosition'] = position * 1000 self.played_info[currentFile]['currentPosition'] = position * 1000
self.reportPlayback() self.reportPlayback()
def onPlayBackStopped(self): def onPlayBackStopped(self):