Skip to content

Commit f16058f

Browse files
authored
Minor improvements to fetching season/show (#950)
* Check parentIndex is an integer for Episode.seasonEpisode * Saves an extra API call to `season()` for Season 0 (Specials) * Use parentKey and grandparentKey to fetch show
1 parent f7f2b6b commit f16058f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

plexapi/video.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ def onDeck(self):
702702

703703
def show(self):
704704
""" Return the season's :class:`~plexapi.video.Show`. """
705-
return self.fetchItem(self.parentRatingKey)
705+
return self.fetchItem(self.parentKey)
706706

707707
def watched(self):
708708
""" Returns list of watched :class:`~plexapi.video.Episode` objects. """
@@ -872,7 +872,7 @@ def episodeNumber(self):
872872
def seasonNumber(self):
873873
""" Returns the episode's season number. """
874874
if self._seasonNumber is None:
875-
self._seasonNumber = self.parentIndex if self.parentIndex else self.season().seasonNumber
875+
self._seasonNumber = self.parentIndex if isinstance(self.parentIndex, int) else self.season().seasonNumber
876876
return utils.cast(int, self._seasonNumber)
877877

878878
@property
@@ -901,7 +901,7 @@ def season(self):
901901

902902
def show(self):
903903
"""" Return the episode's :class:`~plexapi.video.Show`. """
904-
return self.fetchItem(self.grandparentRatingKey)
904+
return self.fetchItem(self.grandparentKey)
905905

906906
def _defaultSyncTitle(self):
907907
""" Returns str, default title for a new syncItem. """

0 commit comments

Comments
 (0)