File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed
Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -930,7 +930,11 @@ def _loadData(self, data):
930930 @cached_property
931931 def parentKey (self ):
932932 """ Returns the parentKey. Refer to the Episode attributes. """
933- return self ._parentKey or f'/library/metadata/{ self .parentRatingKey } '
933+ if self ._parentKey :
934+ return self ._parentKey
935+ if self .parentRatingKey :
936+ return f'/library/metadata/{ self .parentRatingKey } '
937+ return None
934938
935939 @cached_property
936940 def parentRatingKey (self ):
@@ -940,17 +944,25 @@ def parentRatingKey(self):
940944 # Parse the parentRatingKey from the parentThumb
941945 if self ._parentThumb and self ._parentThumb .startswith ('/library/metadata/' ):
942946 return utils .cast (int , self ._parentThumb .split ('/' )[3 ])
943- # Get the parentRatingKey from the season's ratingKey
944- return self ._season .ratingKey
947+ # Get the parentRatingKey from the season's ratingKey if available
948+ if self ._season :
949+ return self ._season .ratingKey
950+ return None
945951
946952 @cached_property
947953 def parentThumb (self ):
948954 """ Returns the parentThumb. Refer to the Episode attributes. """
949- return self ._parentThumb or self ._season .thumb
955+ if self ._parentThumb :
956+ return self ._parentThumb
957+ if self ._season :
958+ return self ._season .thumb
959+ return None
950960
951961 @cached_property
952962 def _season (self ):
953963 """ Returns the :class:`~plexapi.video.Season` object by querying for the show's children. """
964+ if not self .grandparentKey :
965+ return None
954966 return self .fetchItem (
955967 f'{ self .grandparentKey } /children?excludeAllLeaves=1&index={ self .parentIndex } '
956968 )
You can’t perform that action at this time.
0 commit comments