diff --git a/resources/lib/playlist_func.py b/resources/lib/playlist_func.py index e13a6a07..826b5f1d 100644 --- a/resources/lib/playlist_func.py +++ b/resources/lib/playlist_func.py @@ -12,6 +12,7 @@ from utils import tryEncode, escape_html from PlexAPI import API from PlexFunctions import GetPlexMetadata import json_rpc as js +import variables as v ############################################################################### @@ -148,6 +149,23 @@ class Playlist_Item(object): answ += '%s: %s, ' % (key, str(getattr(self, key))) return answ[:-2] + ">" + def plex_stream_index(self, kodi_stream_index, stream_type): + """ + Pass in the kodi_stream_index [int] in order to receive the Plex stream + index. + + stream_type: 'video', 'audio', 'subtitle' + + Returns None if unsuccessful + """ + stream_type = v.PLEX_STREAM_TYPE_FROM_STREAM_TYPE[stream_type] + count = 0 + for stream in self.xml[0][self.part]: + if stream.attrib['streamType'] == stream_type: + if count == kodi_stream_index: + return stream.attrib['id'] + count += 1 + def playlist_item_from_kodi(kodi_item): """ diff --git a/resources/lib/plexbmchelper/subscribers.py b/resources/lib/plexbmchelper/subscribers.py index 2ad78dec..b1b96abc 100644 --- a/resources/lib/plexbmchelper/subscribers.py +++ b/resources/lib/plexbmchelper/subscribers.py @@ -28,6 +28,12 @@ CONTROLLABLE = { 'stepBack,stepForward' } +STREAM_DETAILS = { + 'video': 'currentvideostream', + 'audio': 'currentaudiostream', + 'subtitle': 'currentsubtitle' +} + class SubscriptionMgr(object): """ @@ -73,7 +79,11 @@ class SubscriptionMgr(object): return server return {} - def _msg(self, players): + def msg(self, players): + """ + Returns a timeline xml as str + (xml containing video, audio, photo player state) + """ LOG.debug('players: %s', players) msg = v.XML_HEADER msg += '