From 81339cc3dc70c7f17e72d382ca5664dd5c907a99 Mon Sep 17 00:00:00 2001 From: blacktwin Date: Sat, 23 May 2020 23:20:22 -0400 Subject: [PATCH] import library and create hubs method --- plexapi/video.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/plexapi/video.py b/plexapi/video.py index b954b55a..8f5fdadb 100644 --- a/plexapi/video.py +++ b/plexapi/video.py @@ -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