Fixes to Companion /poll replies
This commit is contained in:
parent
41abcc8d2c
commit
c3b5054477
2 changed files with 16 additions and 9 deletions
|
@ -148,10 +148,12 @@ class MyHandler(BaseHTTPRequestHandler):
|
||||||
subMgr.msg(js.get_players())),
|
subMgr.msg(js.get_players())),
|
||||||
{
|
{
|
||||||
'X-Plex-Client-Identifier': v.PKC_MACHINE_IDENTIFIER,
|
'X-Plex-Client-Identifier': v.PKC_MACHINE_IDENTIFIER,
|
||||||
|
'X-Plex-Protocol': '1.0',
|
||||||
|
'Access-Control-Allow-Origin': '*',
|
||||||
|
'Access-Control-Max-Age': '1209600',
|
||||||
'Access-Control-Expose-Headers':
|
'Access-Control-Expose-Headers':
|
||||||
'X-Plex-Client-Identifier',
|
'X-Plex-Client-Identifier',
|
||||||
'Access-Control-Allow-Origin': '*',
|
'Content-Type': 'text/xml;charset=utf-8'
|
||||||
'Content-Type': 'text/xml'
|
|
||||||
})
|
})
|
||||||
elif "/unsubscribe" in request_path:
|
elif "/unsubscribe" in request_path:
|
||||||
self.response(v.COMPANION_OK_MESSAGE,
|
self.response(v.COMPANION_OK_MESSAGE,
|
||||||
|
|
|
@ -18,6 +18,14 @@ log = logging.getLogger("PLEX."+__name__)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
# What is Companion controllable?
|
||||||
|
CONTROLLABLE = {
|
||||||
|
v.PLEX_TYPE_PHOTO: 'skipPrevious,skipNext,stop',
|
||||||
|
v.PLEX_TYPE_AUDIO: 'playPause,stop,volume,shuffle,repeat,seekTo,' \
|
||||||
|
'skipPrevious,skipNext,stepBack,stepForward',
|
||||||
|
v.PLEX_TYPE_VIDEO: 'playPause,stop,volume,audioStream,subtitleStream,' \
|
||||||
|
'seekTo,skipPrevious,skipNext,stepBack,stepForward'
|
||||||
|
}
|
||||||
|
|
||||||
class SubscriptionManager:
|
class SubscriptionManager:
|
||||||
def __init__(self, RequestMgr, player, mgr):
|
def __init__(self, RequestMgr, player, mgr):
|
||||||
|
@ -56,7 +64,7 @@ class SubscriptionManager:
|
||||||
log.debug('players: %s', players)
|
log.debug('players: %s', players)
|
||||||
msg = v.XML_HEADER
|
msg = v.XML_HEADER
|
||||||
msg += '<MediaContainer size="3" commandID="INSERTCOMMANDID"'
|
msg += '<MediaContainer size="3" commandID="INSERTCOMMANDID"'
|
||||||
msg += ' machineIdentifier="%s" location="fullScreenVideo">' % window('plex_client_Id')
|
msg += ' machineIdentifier="%s">' % v.PKC_MACHINE_IDENTIFIER
|
||||||
msg += self.getTimelineXML(players.get(v.KODI_TYPE_AUDIO),
|
msg += self.getTimelineXML(players.get(v.KODI_TYPE_AUDIO),
|
||||||
v.PLEX_TYPE_AUDIO)
|
v.PLEX_TYPE_AUDIO)
|
||||||
msg += self.getTimelineXML(players.get(v.KODI_TYPE_PHOTO),
|
msg += self.getTimelineXML(players.get(v.KODI_TYPE_PHOTO),
|
||||||
|
@ -77,12 +85,13 @@ class SubscriptionManager:
|
||||||
self.playerprops[playerid] = info
|
self.playerprops[playerid] = info
|
||||||
status = info['state']
|
status = info['state']
|
||||||
time = info['time']
|
time = info['time']
|
||||||
ret = ('\n <Timeline state="%s" time="%s" type="%s"'
|
ret = ('\n <Timeline state="%s" controllable="%s" type="%s" '
|
||||||
% (status, time, ptype))
|
'itemType="%s"' % (status, CONTROLLABLE[ptype], ptype, ptype))
|
||||||
if player is None:
|
if player is None:
|
||||||
ret += ' />'
|
ret += ' />'
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
ret += ' time="%s"' % time
|
||||||
pbmc_server = window('pms_server')
|
pbmc_server = window('pms_server')
|
||||||
if pbmc_server:
|
if pbmc_server:
|
||||||
(self.protocol, self.server, self.port) = \
|
(self.protocol, self.server, self.port) = \
|
||||||
|
@ -114,7 +123,6 @@ class SubscriptionManager:
|
||||||
ret += ' containerKey="%s"' % self.containerKey
|
ret += ' containerKey="%s"' % self.containerKey
|
||||||
|
|
||||||
ret += ' duration="%s"' % info['duration']
|
ret += ' duration="%s"' % info['duration']
|
||||||
ret += ' controllable="%s"' % self.controllable()
|
|
||||||
ret += ' machineIdentifier="%s"' % serv.get('uuid', "")
|
ret += ' machineIdentifier="%s"' % serv.get('uuid', "")
|
||||||
ret += ' protocol="%s"' % serv.get('protocol', "http")
|
ret += ' protocol="%s"' % serv.get('protocol', "http")
|
||||||
ret += ' address="%s"' % serv.get('server', self.server)
|
ret += ' address="%s"' % serv.get('server', self.server)
|
||||||
|
@ -201,9 +209,6 @@ class SubscriptionManager:
|
||||||
log.debug("Sent server notification with parameters: %s to %s"
|
log.debug("Sent server notification with parameters: %s to %s"
|
||||||
% (params, url))
|
% (params, url))
|
||||||
|
|
||||||
def controllable(self):
|
|
||||||
return "volume,shuffle,repeat,audioStream,videoStream,subtitleStream,skipPrevious,skipNext,seekTo,stepBack,stepForward,stop,playPause"
|
|
||||||
|
|
||||||
def addSubscriber(self, protocol, host, port, uuid, commandID):
|
def addSubscriber(self, protocol, host, port, uuid, commandID):
|
||||||
sub = Subscriber(protocol,
|
sub = Subscriber(protocol,
|
||||||
host,
|
host,
|
||||||
|
|
Loading…
Add table
Reference in a new issue