Open nwithan8 opened 4 years ago
Update:
New Directory
class for plexapi.video
:
@utils.registerPlexObject
class Directory(Video):
""" Represents a single Directory."""
TAG = 'Directory'
TYPE = 'channel'
METADATA_TYPE = 'channel'
def _loadData(self, data):
self._data = data
self.guid = data.attrib.get('id')
self.thumb = data.attrib.get('thumb')
self.title = data.attrib.get('title')
self.type = data.attrib.get('type')
self.items = self.findItems(data)
def __len__(self):
return self.size
New method for plexapi.myplex
IPTV = "https://epg.provider.plex.tv/"
def iptv(self):
""" Returns a list of IPTV Hub items :class:`~plexapi.library.Hub`
"""
req = requests.get(self.IPTV + 'hubs/sections/all', headers={'X-Plex-Token': self._token})
elem = ElementTree.fromstring(req.text)
return self.findItems(elem)
I was going to make a pull request, but I have some outdated, unrelated edits on my fork for Live TV that I don't want to include as part of the PR.
There are some builtin tools for what you have in your method:
def iptv(self):
""" Returns a list of IPTV Hub items :class:`~plexapi.library.Hub`
"""
data= self.query(self.IPTV + 'hubs/sections/all')
return self.findItems(data)
or
return self.fetchItems(self.IPTV + 'hubs/sections/all')
PRs are always welcome.
Dug through your source code to find the typical structure for the podcasts, webshows, etc. endpoints. Then dug through network logs while streaming to find the live TV endpoint: https://epg.provider.plex.tv
I'm working on shoehorning it in for a separate Plex-related project, but I'd be happy to roll it into a pull request for this API package. I've also been expanding the (now old) Live TV functionality, creating DVR items, etc. based off issue #182