PKC player does not need another player instance

This commit is contained in:
tomkat83 2016-07-23 18:16:44 +02:00
parent eff7d7b68b
commit ee802428f9

View file

@ -34,7 +34,6 @@ class Player(xbmc.Player):
self.clientInfo = clientinfo.ClientInfo() self.clientInfo = clientinfo.ClientInfo()
self.doUtils = downloadutils.DownloadUtils().downloadUrl self.doUtils = downloadutils.DownloadUtils().downloadUrl
self.xbmcplayer = xbmc.Player()
xbmc.Player.__init__(self) xbmc.Player.__init__(self)
@ -53,7 +52,7 @@ class Player(xbmc.Player):
# Get current file (in utf-8!) # Get current file (in utf-8!)
try: try:
currentFile = self.xbmcplayer.getPlayingFile() currentFile = self.getPlayingFile()
xbmc.sleep(300) xbmc.sleep(300)
except: except:
currentFile = "" currentFile = ""
@ -61,7 +60,7 @@ class Player(xbmc.Player):
while not currentFile: while not currentFile:
xbmc.sleep(100) xbmc.sleep(100)
try: try:
currentFile = self.xbmcplayer.getPlayingFile() currentFile = self.getPlayingFile()
except: except:
pass pass
if count == 20: if count == 20:
@ -110,13 +109,13 @@ class Player(xbmc.Player):
# Start at, when using custom playlist (play to Kodi from webclient) # Start at, when using custom playlist (play to Kodi from webclient)
self.logMsg("Seeking to: %s" % customseek, 1) self.logMsg("Seeking to: %s" % customseek, 1)
try: try:
self.xbmcplayer.seekTime(int(customseek)) self.seekTime(int(customseek))
except: except:
self.logMsg('Could not seek!', -1) self.logMsg('Could not seek!', -1)
window('plex_customplaylist.seektime', clear=True) window('plex_customplaylist.seektime', clear=True)
try: try:
seekTime = self.xbmcplayer.getTime() seekTime = self.getTime()
except RuntimeError: except RuntimeError:
self.logMsg('Could not get current seektime from xbmc player', -1) self.logMsg('Could not get current seektime from xbmc player', -1)
seekTime = 0 seekTime = 0
@ -226,7 +225,7 @@ class Player(xbmc.Player):
runtime = int(runtime) runtime = int(runtime)
except ValueError: except ValueError:
try: try:
runtime = self.xbmcplayer.getTotalTime() runtime = self.getTotalTime()
self.logMsg("Runtime is missing, Kodi runtime: %s" self.logMsg("Runtime is missing, Kodi runtime: %s"
% runtime, 1) % runtime, 1)
except: except:
@ -450,7 +449,7 @@ class Player(xbmc.Player):
if self.played_info.get(currentFile): if self.played_info.get(currentFile):
try: try:
position = self.xbmcplayer.getTime() position = self.getTime()
except RuntimeError: except RuntimeError:
# When Kodi is not playing # When Kodi is not playing
return return