diff --git a/lib/plexapi/base.py b/lib/plexapi/base.py index cfe82050..e80b540f 100644 --- a/lib/plexapi/base.py +++ b/lib/plexapi/base.py @@ -31,7 +31,7 @@ OPERATORS = { } -class PlexObject(object): +class PlexObject: """ Base class for all Plex objects. Parameters: @@ -50,12 +50,12 @@ class PlexObject(object): self._initpath = initpath or self.key self._parent = weakref.ref(parent) if parent is not None else None self._details_key = None + self._overwriteNone = True # Allow overwriting previous attribute values with `None` when manually reloading + self._autoReload = True # Automatically reload the object when accessing a missing attribute + self._edits = None # Save batch edits for a single API call if data is not None: self._loadData(data) self._details_key = self._buildDetailsKey() - self._overwriteNone = True - self._edits = None # Save batch edits for a single API call - self._autoReload = True # Automatically reload the object when accessing a missing attribute def __repr__(self): uid = self._clean(self.firstAttr('_baseurl', 'key', 'id', 'playQueueID', 'uri')) @@ -649,7 +649,7 @@ class PlexPartialObject(PlexObject): return self._getWebURL(base=base) -class Playable(object): +class Playable: """ This is a general place to store functions specific to media that is Playable. Things were getting mixed up a bit when dealing with Shows, Season, Artists, Albums which are all not playable. diff --git a/lib/plexapi/const.py b/lib/plexapi/const.py index 3d1860fc..250389fb 100644 --- a/lib/plexapi/const.py +++ b/lib/plexapi/const.py @@ -4,6 +4,6 @@ # Library version MAJOR_VERSION = 4 MINOR_VERSION = 11 -PATCH_VERSION = 1 +PATCH_VERSION = 2 __short_version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}" __version__ = f"{__short_version__}.{PATCH_VERSION}" diff --git a/lib/plexapi/mixins.py b/lib/plexapi/mixins.py index 906ab81d..4a6e1f0c 100644 --- a/lib/plexapi/mixins.py +++ b/lib/plexapi/mixins.py @@ -8,7 +8,7 @@ from plexapi.exceptions import BadRequest, NotFound from plexapi.utils import deprecated -class AdvancedSettingsMixin(object): +class AdvancedSettingsMixin: """ Mixin for Plex objects that can have advanced settings. """ def preferences(self): @@ -60,7 +60,7 @@ class AdvancedSettingsMixin(object): self._server.query(url, method=self._server._session.put) -class SmartFilterMixin(object): +class SmartFilterMixin: """ Mixing for Plex objects that can have smart filters. """ def _parseFilters(self, content): @@ -120,7 +120,7 @@ class SmartFilterMixin(object): return {filterOp: rules} -class SplitMergeMixin(object): +class SplitMergeMixin: """ Mixin for Plex objects that can be split and merged. """ def split(self): @@ -141,7 +141,7 @@ class SplitMergeMixin(object): return self._server.query(key, method=self._server._session.put) -class UnmatchMatchMixin(object): +class UnmatchMatchMixin: """ Mixin for Plex objects that can be unmatched and matched. """ def unmatch(self): @@ -234,7 +234,7 @@ class UnmatchMatchMixin(object): self._server.query(data, method=self._server._session.put) -class ExtrasMixin(object): +class ExtrasMixin: """ Mixin for Plex objects that can have extras. """ def extras(self): @@ -244,7 +244,7 @@ class ExtrasMixin(object): return self.findItems(data, Extra, rtag='Extras') -class HubsMixin(object): +class HubsMixin: """ Mixin for Plex objects that can have related hubs. """ def hubs(self): @@ -254,7 +254,7 @@ class HubsMixin(object): return self.findItems(data, Hub, rtag='Related') -class RatingMixin(object): +class RatingMixin: """ Mixin for Plex objects that can have user star ratings. """ def rate(self, rating=None): @@ -274,7 +274,7 @@ class RatingMixin(object): self._server.query(key, method=self._server._session.put) -class ArtUrlMixin(object): +class ArtUrlMixin: """ Mixin for Plex objects that can have a background artwork url. """ @property @@ -323,7 +323,7 @@ class ArtMixin(ArtUrlMixin): return self._edit(**{'art.locked': 0}) -class BannerUrlMixin(object): +class BannerUrlMixin: """ Mixin for Plex objects that can have a banner url. """ @property @@ -372,7 +372,7 @@ class BannerMixin(BannerUrlMixin): return self._edit(**{'banner.locked': 0}) -class PosterUrlMixin(object): +class PosterUrlMixin: """ Mixin for Plex objects that can have a poster url. """ @property @@ -426,7 +426,7 @@ class PosterMixin(PosterUrlMixin): return self._edit(**{'thumb.locked': 0}) -class ThemeUrlMixin(object): +class ThemeUrlMixin: """ Mixin for Plex objects that can have a theme url. """ @property @@ -475,7 +475,7 @@ class ThemeMixin(ThemeUrlMixin): self._edit(**{'theme.locked': 0}) -class EditFieldMixin(object): +class EditFieldMixin: """ Mixin for editing Plex object fields. """ def editField(self, field, value, locked=True, **kwargs): @@ -667,7 +667,7 @@ class PhotoCapturedTimeMixin(EditFieldMixin): return self.editField('originallyAvailableAt', capturedTime, locked=locked) -class EditTagsMixin(object): +class EditTagsMixin: """ Mixin for editing Plex object tags. """ @deprecated('use "editTags" instead') @@ -986,7 +986,7 @@ class WriterMixin(EditTagsMixin): return self.editTags('writer', writers, locked=locked, remove=True) -class WatchlistMixin(object): +class WatchlistMixin: """ Mixin for Plex objects that can be added to a user's watchlist. """ def onWatchlist(self, account=None): diff --git a/lib/plexapi/myplex.py b/lib/plexapi/myplex.py index a05a74bd..b7e72d0f 100644 --- a/lib/plexapi/myplex.py +++ b/lib/plexapi/myplex.py @@ -1333,7 +1333,7 @@ class MyPlexDevice(PlexObject): return self._server.syncItems(client=self) -class MyPlexPinLogin(object): +class MyPlexPinLogin: """ MyPlex PIN login class which supports getting the four character PIN which the user must enter on https://plex.tv/link to authenticate the client and provide an access token to diff --git a/lib/plexapi/sync.py b/lib/plexapi/sync.py index 53dc0636..0a02f4e9 100644 --- a/lib/plexapi/sync.py +++ b/lib/plexapi/sync.py @@ -130,7 +130,7 @@ class SyncList(PlexObject): self.items.append(item) -class Status(object): +class Status: """ Represents a current status of specific :class:`~plexapi.sync.SyncItem`. Attributes: @@ -168,7 +168,7 @@ class Status(object): )) -class MediaSettings(object): +class MediaSettings: """ Transcoding settings used for all media within :class:`~plexapi.sync.SyncItem`. Attributes: @@ -239,7 +239,7 @@ class MediaSettings(object): raise BadRequest('Unexpected photo quality') -class Policy(object): +class Policy: """ Policy of syncing the media (how many items to sync and process watched media or not). Attributes: diff --git a/lib/plexapi/video.py b/lib/plexapi/video.py index 1604fef3..95f8336d 100644 --- a/lib/plexapi/video.py +++ b/lib/plexapi/video.py @@ -702,7 +702,7 @@ class Season( def show(self): """ Return the season's :class:`~plexapi.video.Show`. """ - return self.fetchItem(self.parentRatingKey) + return self.fetchItem(self.parentKey) def watched(self): """ Returns list of watched :class:`~plexapi.video.Episode` objects. """ @@ -872,7 +872,7 @@ class Episode( def seasonNumber(self): """ Returns the episode's season number. """ if self._seasonNumber is None: - self._seasonNumber = self.parentIndex if self.parentIndex else self.season().seasonNumber + self._seasonNumber = self.parentIndex if isinstance(self.parentIndex, int) else self.season().seasonNumber return utils.cast(int, self._seasonNumber) @property @@ -901,7 +901,7 @@ class Episode( def show(self): """" Return the episode's :class:`~plexapi.video.Show`. """ - return self.fetchItem(self.grandparentRatingKey) + return self.fetchItem(self.grandparentKey) def _defaultSyncTitle(self): """ Returns str, default title for a new syncItem. """ diff --git a/requirements.txt b/requirements.txt index 7031b33e..fe7156aa 100644 --- a/requirements.txt +++ b/requirements.txt @@ -27,7 +27,7 @@ MarkupSafe==2.1.1 musicbrainzngs==0.7.1 packaging==21.3 paho-mqtt==1.6.1 -plexapi==4.11.1 +plexapi==4.11.2 portend==3.1.0 profilehooks==1.12.0 PyJWT==2.4.0