Cleanup playback commands; Remove proxy tests, it needs a bit more expirimentation

This commit is contained in:
Michael Shepanski 2016-03-24 22:36:25 -04:00
parent b277facf10
commit 03469a7f55
3 changed files with 41 additions and 41 deletions

View file

@ -46,7 +46,7 @@ class Client(object):
def sendClientCommand(self, command, **params):
command = command.strip('/')
controller = command.split('/')[1]
controller = command.split('/')[0]
if controller not in self.protocolCapabilities:
raise Unsupported('Client %s does not support the %s controller.' % (self.quickName, controller))
self._commandId += 1
@ -56,7 +56,7 @@ class Client(object):
'X-Plex-Target-Client-Identifier': self.machineIdentifier,
'commandID': self._commandId,
})
url = 'http://%s:%s/%s%s' % (self.address, self.port, command.lstrip('/'), utils.joinArgs(params))
url = 'http://%s:%s/player/%s%s' % (self.address, self.port, command.lstrip('/'), utils.joinArgs(params))
log.info('GET %s', url)
response = requests.get(url, timeout=TIMEOUT)
if response.status_code != requests.codes.ok:
@ -72,24 +72,24 @@ class Client(object):
# Navigation Commands
# These commands navigate around the user interface.
def contextMenu(self): self.sendCommand('player/navigation/contextMenu')
def goBack(self): self.sendCommand('player/navigation/back')
def goToHome(self): self.sendCommand('/player/navigation/home')
def goToMusic(self): self.sendCommand('/player/navigation/music')
def moveDown(self): self.sendCommand('player/navigation/moveDown')
def moveLeft(self): self.sendCommand('player/navigation/moveLeft')
def moveRight(self): self.sendCommand('player/navigation/moveRight')
def moveUp(self): self.sendCommand('player/navigation/moveUp')
def nextLetter(self): self.sendCommand('player/navigation/nextLetter')
def pageDown(self): self.sendCommand('player/navigation/pageDown')
def pageUp(self): self.sendCommand('player/navigation/pageUp')
def previousLetter(self): self.sendCommand('player/navigation/previousLetter')
def select(self): self.sendCommand('player/navigation/select')
def toggleOSD(self): self.sendCommand('player/navigation/toggleOSD')
def contextMenu(self): self.sendCommand('navigation/contextMenu')
def goBack(self): self.sendCommand('navigation/back')
def goToHome(self): self.sendCommand('/navigation/home')
def goToMusic(self): self.sendCommand('/navigation/music')
def moveDown(self): self.sendCommand('navigation/moveDown')
def moveLeft(self): self.sendCommand('navigation/moveLeft')
def moveRight(self): self.sendCommand('navigation/moveRight')
def moveUp(self): self.sendCommand('navigation/moveUp')
def nextLetter(self): self.sendCommand('navigation/nextLetter')
def pageDown(self): self.sendCommand('navigation/pageDown')
def pageUp(self): self.sendCommand('navigation/pageUp')
def previousLetter(self): self.sendCommand('navigation/previousLetter')
def select(self): self.sendCommand('navigation/select')
def toggleOSD(self): self.sendCommand('navigation/toggleOSD')
def goToMedia(self, media, **params):
server_uri = media.server.baseuri.split(':')
self.sendCommand('player/mirror/details', **dict({
self.sendCommand('mirror/details', **dict({
'machineIdentifier': self.server.machineIdentifier,
'address': server_uri[1].strip('/'),
'port': server_uri[-1],
@ -101,16 +101,16 @@ class Client(object):
# to specify which media type to apply the command to, (except for playMedia). This
# is in case there are multiple things happening (e.g. music in the background, photo
# slideshow in the foreground).
def pause(self, mtype): self.sendCommand('player/playback/pause', type=mtype)
def play(self, mtype): self.sendCommand('player/playback/play', type=mtype)
def refreshPlayQueue(self, playQueueID, mtype=None): self.sendCommand('player/playback/refreshPlayQueue', playQueueID=playQueueID, type=mtype)
def seekTo(self, offset, mtype=None): self.sendCommand('player/playback/seekTo', offset=offset, type=mtype) # offset in milliseconds
def skipNext(self, mtype=None): self.sendCommand('player/playback/skipNext', type=mtype)
def skipPrevious(self, mtype=None): self.sendCommand('player/playback/skipPrevious', type=mtype)
def skipTo(self, key, mtype=None): self.sendCommand('player/playback/skipTo', key=key, type=mtype) # skips to item with matching key
def stepBack(self, mtype=None): self.sendCommand('player/playback/stepBack', type=mtype)
def stepForward(self, mtype): self.sendCommand('player/playback/stepForward', type=mtype)
def stop(self, mtype): self.sendCommand('player/playback/stop', type=mtype)
def pause(self, mtype): self.sendCommand('playback/pause', type=mtype)
def play(self, mtype): self.sendCommand('playback/play', type=mtype)
def refreshPlayQueue(self, playQueueID, mtype=None): self.sendCommand('playback/refreshPlayQueue', playQueueID=playQueueID, type=mtype)
def seekTo(self, offset, mtype=None): self.sendCommand('playback/seekTo', offset=offset, type=mtype) # offset in milliseconds
def skipNext(self, mtype=None): self.sendCommand('playback/skipNext', type=mtype)
def skipPrevious(self, mtype=None): self.sendCommand('playback/skipPrevious', type=mtype)
def skipTo(self, key, mtype=None): self.sendCommand('playback/skipTo', key=key, type=mtype) # skips to item with matching key
def stepBack(self, mtype=None): self.sendCommand('playback/stepBack', type=mtype)
def stepForward(self, mtype): self.sendCommand('playback/stepForward', type=mtype)
def stop(self, mtype): self.sendCommand('playback/stop', type=mtype)
def setRepeat(self, repeat, mtype): self.setParameters(repeat=repeat, mtype=mtype) # 0=off, 1=repeatone, 2=repeatall
def setShuffle(self, shuffle, mtype): self.setParameters(shuffle=shuffle, mtype=mtype) # 0=off, 1=on
def setVolume(self, volume, mtype): self.setParameters(volume=volume, mtype=mtype) # 0-100
@ -121,7 +121,7 @@ class Client(object):
def playMedia(self, media, **params):
server_uri = media.server.baseuri.split(':')
playqueue = self.server.createPlayQueue(media)
self.sendCommand('player/playback/playMedia', **dict({
self.sendCommand('playback/playMedia', **dict({
'machineIdentifier': self.server.machineIdentifier,
'address': server_uri[1].strip('/'),
'port': server_uri[-1],
@ -135,7 +135,7 @@ class Client(object):
if shuffle is not None: params['shuffle'] = shuffle # 0=off, 1=on
if volume is not None: params['volume'] = volume # 0-100
if mtype is not None: params['type'] = mtype # music,photo,video
self.sendCommand('player/playback/setParameters', **params)
self.sendCommand('playback/setParameters', **params)
def setStreams(self, audioStreamID=None, subtitleStreamID=None, videoStreamID=None, mtype=None):
# Can possibly send {next,on,off}
@ -144,7 +144,7 @@ class Client(object):
if subtitleStreamID is not None: params['subtitleStreamID'] = subtitleStreamID
if videoStreamID is not None: params['videoStreamID'] = videoStreamID
if mtype is not None: params['type'] = mtype # music,photo,video
self.sendCommand('player/playback/setStreams', **params)
self.sendCommand('playback/setStreams', **params)
# Timeline Commands
def timeline(self):

View file

@ -355,11 +355,11 @@ def test_client_navigation(plex, user=None):
_navigate(plex, client)
@register('client')
def test_client_navigation_via_proxy(plex, user=None):
client = plex.client(PLEX_CLIENT)
client.proxyThroughServer()
_navigate(plex, client)
# @register('client')
# def test_client_navigation_via_proxy(plex, user=None):
# client = plex.client(PLEX_CLIENT)
# client.proxyThroughServer()
# _navigate(plex, client)
def _navigate(plex, client):
@ -400,11 +400,11 @@ def test_video_playback(plex, user=None):
_video_playback(plex, client)
@register('client')
def test_video_playback_via_proxy(plex, user=None):
client = plex.client(PLEX_CLIENT)
client.proxyThroughServer()
_video_playback(plex, client)
# @register('client')
# def test_video_playback_via_proxy(plex, user=None):
# client = plex.client(PLEX_CLIENT)
# client.proxyThroughServer()
# _video_playback(plex, client)
def _video_playback(plex, client):

View file

@ -44,7 +44,7 @@ def iter_tests(query):
elif tags:
matching_tags = [t for t in tags if t in test['tags']]
if matching_tags: yield test
elif query in test['name']:
elif query == test['name']:
yield test