Fixes to monitoring playback

This commit is contained in:
tomkat83 2016-03-16 18:01:07 +01:00
parent 7f674acbac
commit de810d1e1d
3 changed files with 17 additions and 20 deletions

View file

@ -62,8 +62,6 @@ class KodiMonitor(xbmc.Monitor):
utils.window('emby_logLevel', value=currentLog)
def onNotification(self, sender, method, data):
window = utils.window
if method not in ("Playlist.OnAdd"):
self.logMsg("Method: %s Data: %s" % (method, data), 1)
@ -73,15 +71,6 @@ class KodiMonitor(xbmc.Monitor):
if method == "Player.OnPlay":
self.PlayBackStart(data)
elif method == "Player.OnStop":
# Get rid of some values
window('Plex_currently_playing_itemid', clear=True)
window('emby_customPlaylist', clear=True)
window('emby_customPlaylist.seektime', clear=True)
window('emby_playbackProps', clear=True)
window('suspend_LibraryThread', clear=True)
window('emby_customPlaylist.seektime', clear=True)
elif method == "VideoLibrary.OnUpdate":
# Manually marking as watched/unwatched
playcount = data.get('playcount')

View file

@ -447,19 +447,26 @@ class Player(xbmc.Player):
self.reportPlayback()
def onPlayBackStopped(self):
# Will be called when user stops xbmc playing a file
log = self.logMsg
window = utils.window
# Will be called when user stops xbmc playing a file
log("ONPLAYBACK_STOPPED", 2)
log("Clear playlist properties.", 1)
log("ONPLAYBACK_STOPPED", 1)
self.stopAll()
window('Plex_currently_playing_itemid', clear=True)
window('emby_customPlaylist', clear=True)
window('emby_customPlaylist.seektime', clear=True)
window('emby_playbackProps', clear=True)
window('suspend_LibraryThread', clear=True)
window('emby_customPlaylist.seektime', clear=True)
log("Clear playlist properties.", 1)
def onPlayBackEnded(self):
# Will be called when xbmc stops playing a file
self.logMsg("ONPLAYBACK_ENDED", 2)
self.stopAll()
# Will be called when xbmc stops playing a file, because the file ended
self.logMsg("ONPLAYBACK_ENDED", 1)
self.onPlayBackStopped()
def stopAll(self):

View file

@ -91,12 +91,13 @@ class SubscriptionManager:
(self.server, self.port) = pbmc_server.split(':')
serv = getServerByHost(self.server)
if info.get('playQueueID'):
self.containerKey = "/playQueues/%s" % info.get('playQueueID')
ret += ' playQueueID="%s"' % info.get('playQueueID')
ret += ' playQueueVersion="%s"' % info.get('playQueueVersion')
ret += ' playQueueItemID="%s"' % (info.get('playQueueItemID'))
ret += ' containerKey="/playQueues/%s"' \
% (info.get('playQueueID'))
ret += ' containerKey="%s"' % self.containerKey
elif keyid:
self.containerKey = self.lastkey
ret += ' containerKey="%s"' % (self.containerKey)
ret += ' duration="%s"' % info['duration']