Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better/own PlayerProcessInfo implementation #220

Open
wants to merge 26 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6a604df
add stream info option to playback settings dialog to show playerproc…
pannal Jul 6, 2018
01d74f0
use Action instead of ActivateWindow for playerprocessinfo
pannal Jul 6, 2018
fb5f574
add own playerprocessinfo control; hide it when settings or playlist …
pannal Jul 8, 2018
236698b
add VideoSessionInfo class for determing which decisions the PMS made
pannal Jul 9, 2018
5d2736d
re-add stubs for missing plexobjects
pannal Jul 9, 2018
baf0189
add sessions property to plexserver; add findVideoSession method
pannal Jul 9, 2018
c7dedf3
add session info to video instances
pannal Jul 9, 2018
1216761
add advanced PPI dialog with PMS stream info data
pannal Jul 9, 2018
2d353fa
toggle PPI dialog on key 61519
pannal Jul 10, 2018
2d52f9a
render PPI dialog below the OSD
pannal Jul 10, 2018
582046b
position CPU information separately because it can get very long on m…
pannal Jul 10, 2018
cc2af11
only attempt to gather plex session information when the current user…
pannal Jul 10, 2018
6b97f95
display PPI window above the backdrop, below the OSD
pannal Jul 10, 2018
5fb5d3f
use PlexObjects instead of MyPlex* for user, player and session
pannal Jul 10, 2018
5a3de20
add mediaDetails and mediaDetailsHolder which provide a single locati…
pannal Jul 10, 2018
9d704d5
rewrite VideoSessionInfo; add explicit attribute definitions and help…
pannal Jul 10, 2018
f69d95b
remove remnant skin condition
pannal Jul 10, 2018
6edda19
rename dpAttributeBool to dpAttributeIfExists, rename dpBool to dpCon…
pannal Jul 10, 2018
d24a9c7
PPI: try finding videoSession for up to 5 seconds, as it may not be i…
pannal Jul 11, 2018
727da52
PPI: in case the current user doesn't own the current server, use par…
pannal Jul 11, 2018
d2d2302
implement PPI more cleanly, without the need for all those lambdas, m…
pannal Jul 13, 2018
93bb4ba
widen the plex PPI side a bit
pannal Jul 13, 2018
119bdcc
wait for the player to start before trying to gather data; raise time…
pannal Jul 13, 2018
e877c72
remove debug log entry
pannal Jul 13, 2018
d36f3e9
use correct label widths; make audiocodec label a textbox and autoscr…
pannal Jul 18, 2018
9669bac
hide PPI dialog when stream settings were changed
pannal Aug 15, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/_included_packages/plexnet/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ class Unsupported(Exception):

class Unauthorized(Exception):
pass


class ServerNotOwned(Exception):
pass
4 changes: 4 additions & 0 deletions lib/_included_packages/plexnet/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,7 @@ class Similar(MediaTag):
class Writer(MediaTag):
TYPE = 'Writer'
FILTER = 'writer'


class Bandwidth(plexobjects.PlexObject):
TYPE = 'Bandwidth'
1 change: 1 addition & 0 deletions lib/_included_packages/plexnet/myplex.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import video
import audio
import photo
import plexobjects

video, audio, photo # Hides warning message

Expand Down
3 changes: 2 additions & 1 deletion lib/_included_packages/plexnet/nowplayingmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ def toXmlAttributes(self, elem):

class NowPlayingManager(object):
def __init__(self):

# Constants
self.NAVIGATION = "navigation"
self.FULLSCREEN_VIDEO = "fullScreenVideo"
Expand Down Expand Up @@ -206,6 +205,8 @@ def nowPlayingSetControllable(self, timelineType, name, isControllable):
self.timelines[timelineType].setControllable(name, isControllable)

def onTimelineResponse(self, request, response, context):
context.request.server.trigger("np:timelineResponse", response=response)

if not context.playQueue or not context.playQueue.refreshOnTimeline:
return
context.playQueue.refreshOnTimeline = False
Expand Down
26 changes: 20 additions & 6 deletions lib/_included_packages/plexnet/plexobjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ def _setData(self, data):

self.name = data.tag
for k, v in data.attrib.items():
if k in ("container",):
k = "attrib_%s" % k

setattr(self, k, PlexValue(v, self))

def __getattr__(self, attr):
Expand Down Expand Up @@ -295,22 +298,33 @@ def _findLocation(self, data):
def _findPlayer(self, data):
elem = data.find('Player')
if elem is not None:
from plexapi.client import Client
return Client(self.server, elem)
return PlexObject(elem, server=self.server)
return None

def _findTranscodeSession(self, data):
elem = data.find('TranscodeSession')
if elem is not None:
from plexapi import media
return media.TranscodeSession(self.server, elem)
import media
return media.TranscodeSession(elem, server=self.server)
return None

def _findBandwidths(self, data):
elem = data.find("Bandwidths")
if elem is not None:
import media
return PlexItemList(elem, media.Bandwidth, media.Bandwidth.TYPE, server=self.server)
return []

def _findUser(self, data):
elem = data.find('User')
if elem is not None:
from plexapi.myplex import MyPlexUser
return MyPlexUser(elem, self.initpath)
return PlexObject(elem, self.initpath)
return None

def _findSession(self, data):
elem = data.find('Session')
if elem is not None:
return PlexObject(elem, self.initpath, server=self.server)
return None

def getAbsolutePath(self, attr):
Expand Down
11 changes: 11 additions & 0 deletions lib/_included_packages/plexnet/plexserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,17 @@ def library(self):
else:
return plexlibrary.Library(self.query('/library/'), server=self)

@property
def sessions(self):
if self.owned:
return plexobjects.listItems(self, '/status/sessions')
raise exceptions.ServerNotOwned

def findVideoSession(self, client_id, rating_key):
for item in self.sessions:
if item.session and item.session.id == client_id and item.ratingKey == rating_key:
return item

def buildUrl(self, path, includeToken=False):
if self.activeConnection:
return self.activeConnection.buildUrl(self, path, includeToken)
Expand Down
4 changes: 3 additions & 1 deletion lib/_included_packages/plexnet/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ def _setData(self, data):
self.sessionKey = plexobjects.PlexValue(data.attrib.get('sessionKey', ''), self)
self.user = self._findUser(data)
self.player = self._findPlayer(data)
self.session = self._findSession(data)
self.transcodeSession = self._findTranscodeSession(data)

@property
Expand Down Expand Up @@ -395,6 +396,7 @@ def _setData(self, data):
self.sessionKey = plexobjects.PlexValue(data.attrib.get('sessionKey', ''), self)
self.user = self._findUser(data)
self.player = self._findPlayer(data)
self.session = self._findSession(data)
self.transcodeSession = self._findTranscodeSession(data)

@property
Expand Down Expand Up @@ -471,4 +473,4 @@ def isWatched(self):
return self.get('viewCount').asInt() > 0

def getStreamURL(self, **params):
return self._getStreamURL(**params)
return self._getStreamURL(**params)
Loading