Skip to content

Commit 85aa15b

Browse files
author
Touchstone64
committed
Move the relational key builder into PlexObject and remove the parent-child mixin.
1 parent 88da1e0 commit 85aa15b

3 files changed

Lines changed: 24 additions & 32 deletions

File tree

plexapi/base.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,26 @@ def _buildDetailsKey(self, **kwargs):
176176
details_key += '?' + urlencode(sorted(params.items()))
177177
return details_key
178178

179+
def _buildRelationalKey(self, key, **kwargs):
180+
""" Returns a key suitable for fetching partial objects extended to
181+
include relational information.
182+
183+
Parameters:
184+
key (str): The relational key to be fetched.
185+
**kwargs (dict): Optional query parameters to add to the key, such as
186+
'excludeAllLeaves=1' or 'index=0'. Additional XML filters should instead
187+
be passed into search functions. See :func:`~plexapi.base.PlexObject.fetchItems`
188+
for details.
189+
190+
"""
191+
if not key:
192+
return None
193+
194+
args = {'includeGuids': 1, **kwargs}
195+
params = utils.joinArgs(args)
196+
197+
return f"{key}{params}"
198+
179199
def _isChildOf(self, **kwargs):
180200
""" Returns True if this object is a child of the given attributes.
181201
This will search the parent objects all the way to the top.

plexapi/mixins/__init__.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
from .split_merge import SplitMergeMixin
3030
from .unmatch_match import UnmatchMatchMixin
3131
from .watchlist import WatchlistMixin
32-
from .tv_parent_child import TvParentChildMixin
3332

3433

3534
class MovieEditMixins(
@@ -141,26 +140,23 @@ class ShowMixins(
141140
AdvancedSettingsMixin, SplitMergeMixin, UnmatchMatchMixin, ExtrasMixin, HubsMixin, RatingMixin,
142141
ArtMixin, LogoMixin, PosterMixin, SquareArtMixin, ThemeMixin,
143142
ShowEditMixins,
144-
WatchlistMixin,
145-
TvParentChildMixin
143+
WatchlistMixin
146144
):
147145
pass
148146

149147

150148
class SeasonMixins(
151149
AdvancedSettingsMixin, ExtrasMixin, RatingMixin,
152150
ArtMixin, LogoMixin, PosterMixin, SquareArtMixin, ThemeUrlMixin,
153-
SeasonEditMixins,
154-
TvParentChildMixin
151+
SeasonEditMixins
155152
):
156153
pass
157154

158155

159156
class EpisodeMixins(
160157
ExtrasMixin, RatingMixin,
161158
ArtMixin, LogoMixin, PosterMixin, SquareArtMixin, ThemeUrlMixin,
162-
EpisodeEditMixins,
163-
TvParentChildMixin
159+
EpisodeEditMixins
164160
):
165161
pass
166162

@@ -266,5 +262,5 @@ class PlaylistMixins(
266262
# Composite Mixins
267263
'AlbumMixins', 'ArtistMixins', 'ClipMixins', 'CollectionMixins', 'EpisodeMixins',
268264
'MovieMixins', 'PhotoMixins', 'PhotoalbumMixins', 'PlaylistMixins',
269-
'SeasonMixins', 'ShowMixins', 'TrackMixins', 'TvParentChildMixin'
265+
'SeasonMixins', 'ShowMixins', 'TrackMixins'
270266
]

plexapi/mixins/tv_parent_child.py

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)