Fixed failed playback detection

Multiple instances of xbmc.Player() were called in onPlayBackStarted() causing a failed detection of the file currently playing.
This commit is contained in:
angelblue05 2015-03-22 08:02:38 -05:00
parent 7cbdc48cc0
commit 3b78b8e765

View file

@ -215,9 +215,10 @@ class Player( xbmc.Player ):
WINDOW = xbmcgui.Window( 10000 ) WINDOW = xbmcgui.Window( 10000 )
self.stopAll() self.stopAll()
addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync') addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
xbmcplayer = xbmc.Player()
if xbmc.Player().isPlaying(): if xbmcplayer.isPlaying():
currentFile = xbmc.Player().getPlayingFile() currentFile = xbmcplayer.getPlayingFile()
self.printDebug("mb3sync Service -> onPlayBackStarted" + currentFile,2) self.printDebug("mb3sync Service -> onPlayBackStarted" + currentFile,2)
# grab all the info about this item from the stored windows props # grab all the info about this item from the stored windows props
@ -260,12 +261,12 @@ class Player( xbmc.Player ):
data["runtime"] = runtime data["runtime"] = runtime
data["item_id"] = item_id data["item_id"] = item_id
data["refresh_id"] = refresh_id data["refresh_id"] = refresh_id
data["currentfile"] = xbmc.Player().getPlayingFile() data["currentfile"] = xbmcplayer.getPlayingFile()
data["AudioStreamIndex"] = audioindex data["AudioStreamIndex"] = audioindex
data["SubtitleStreamIndex"] = subtitleindex data["SubtitleStreamIndex"] = subtitleindex
data["playmethod"] = playMethod data["playmethod"] = playMethod
data["Type"] = itemType data["Type"] = itemType
self.played_information[xbmc.Player().getPlayingFile()] = data self.played_information[xbmcplayer.getPlayingFile()] = data
self.printDebug("mb3sync Service -> ADDING_FILE : " + currentFile,2) self.printDebug("mb3sync Service -> ADDING_FILE : " + currentFile,2)
self.printDebug("mb3sync Service -> ADDING_FILE : " + str(self.played_information),2) self.printDebug("mb3sync Service -> ADDING_FILE : " + str(self.played_information),2)
@ -332,4 +333,4 @@ class Player( xbmc.Player ):
xbmc.sleep(100) xbmc.sleep(100)
xbmc.Player().seekTime(seekToTime) xbmc.Player().seekTime(seekToTime)
xbmc.sleep(100) xbmc.sleep(100)
xbmc.Player().play() xbmc.Player().play()