Fixes to monitoring playback
This commit is contained in:
parent
7f674acbac
commit
de810d1e1d
3 changed files with 17 additions and 20 deletions
|
@ -62,8 +62,6 @@ class KodiMonitor(xbmc.Monitor):
|
||||||
utils.window('emby_logLevel', value=currentLog)
|
utils.window('emby_logLevel', value=currentLog)
|
||||||
|
|
||||||
def onNotification(self, sender, method, data):
|
def onNotification(self, sender, method, data):
|
||||||
window = utils.window
|
|
||||||
|
|
||||||
if method not in ("Playlist.OnAdd"):
|
if method not in ("Playlist.OnAdd"):
|
||||||
self.logMsg("Method: %s Data: %s" % (method, data), 1)
|
self.logMsg("Method: %s Data: %s" % (method, data), 1)
|
||||||
|
|
||||||
|
@ -73,15 +71,6 @@ class KodiMonitor(xbmc.Monitor):
|
||||||
if method == "Player.OnPlay":
|
if method == "Player.OnPlay":
|
||||||
self.PlayBackStart(data)
|
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":
|
elif method == "VideoLibrary.OnUpdate":
|
||||||
# Manually marking as watched/unwatched
|
# Manually marking as watched/unwatched
|
||||||
playcount = data.get('playcount')
|
playcount = data.get('playcount')
|
||||||
|
|
|
@ -447,19 +447,26 @@ class Player(xbmc.Player):
|
||||||
self.reportPlayback()
|
self.reportPlayback()
|
||||||
|
|
||||||
def onPlayBackStopped(self):
|
def onPlayBackStopped(self):
|
||||||
|
# Will be called when user stops xbmc playing a file
|
||||||
|
|
||||||
log = self.logMsg
|
log = self.logMsg
|
||||||
window = utils.window
|
window = utils.window
|
||||||
# Will be called when user stops xbmc playing a file
|
log("ONPLAYBACK_STOPPED", 1)
|
||||||
log("ONPLAYBACK_STOPPED", 2)
|
|
||||||
log("Clear playlist properties.", 1)
|
|
||||||
self.stopAll()
|
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):
|
def onPlayBackEnded(self):
|
||||||
# Will be called when xbmc stops playing a file
|
# Will be called when xbmc stops playing a file, because the file ended
|
||||||
self.logMsg("ONPLAYBACK_ENDED", 2)
|
self.logMsg("ONPLAYBACK_ENDED", 1)
|
||||||
|
self.onPlayBackStopped()
|
||||||
self.stopAll()
|
|
||||||
|
|
||||||
def stopAll(self):
|
def stopAll(self):
|
||||||
|
|
||||||
|
|
|
@ -91,12 +91,13 @@ class SubscriptionManager:
|
||||||
(self.server, self.port) = pbmc_server.split(':')
|
(self.server, self.port) = pbmc_server.split(':')
|
||||||
serv = getServerByHost(self.server)
|
serv = getServerByHost(self.server)
|
||||||
if info.get('playQueueID'):
|
if info.get('playQueueID'):
|
||||||
|
self.containerKey = "/playQueues/%s" % info.get('playQueueID')
|
||||||
ret += ' playQueueID="%s"' % info.get('playQueueID')
|
ret += ' playQueueID="%s"' % info.get('playQueueID')
|
||||||
ret += ' playQueueVersion="%s"' % info.get('playQueueVersion')
|
ret += ' playQueueVersion="%s"' % info.get('playQueueVersion')
|
||||||
ret += ' playQueueItemID="%s"' % (info.get('playQueueItemID'))
|
ret += ' playQueueItemID="%s"' % (info.get('playQueueItemID'))
|
||||||
ret += ' containerKey="/playQueues/%s"' \
|
ret += ' containerKey="%s"' % self.containerKey
|
||||||
% (info.get('playQueueID'))
|
|
||||||
elif keyid:
|
elif keyid:
|
||||||
|
self.containerKey = self.lastkey
|
||||||
ret += ' containerKey="%s"' % (self.containerKey)
|
ret += ' containerKey="%s"' % (self.containerKey)
|
||||||
|
|
||||||
ret += ' duration="%s"' % info['duration']
|
ret += ' duration="%s"' % info['duration']
|
||||||
|
|
Loading…
Reference in a new issue