import library and create hubs method

This commit is contained in:
blacktwin 2020-05-23 23:20:22 -04:00
parent 6a69fe4810
commit 81339cc3dc

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from plexapi import media, utils, settings
from plexapi import media, utils, settings, library
from plexapi.exceptions import BadRequest, NotFound
from plexapi.base import Playable, PlexPartialObject
from plexapi.compat import quote_plus, urlencode
@ -445,6 +445,16 @@ class Show(Video):
return items
def hubs(self):
""" Returns a list of :class:`~plexapi.library.Hub` objects. """
items = []
data = self._server.query(self._details_key)
for item in data.iter('Related'):
for elem in item:
items.append(library.Hub(data=elem, server=self._server))
return items
def seasons(self, **kwargs):
""" Returns a list of :class:`~plexapi.video.Season` objects. """
key = '/library/metadata/%s/children?excludeAllLeaves=1' % self.ratingKey