mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-10 06:04:15 +00:00
Add hasPreviewThumbnails properties
This commit is contained in:
parent
12701ab997
commit
5e7a5e572c
2 changed files with 16 additions and 1 deletions
|
@ -112,7 +112,7 @@ class MediaPart(PlexObject):
|
|||
has64bitOffsets (bool): True if the file has 64 bit offsets.
|
||||
hasThumbnail (bool): True if the file (track) has an embedded thumbnail.
|
||||
id (int): The unique ID for this media part on the server.
|
||||
indexes (str, None): sd if the file has generated BIF thumbnails.
|
||||
indexes (str, None): sd if the file has generated preview (BIF) thumbnails.
|
||||
key (str): API URL (ex: /library/parts/46618/1389985872/file.mkv).
|
||||
optimizedForStreaming (bool): True if the file is optimized for streaming.
|
||||
packetLength (int): The packet length of the file.
|
||||
|
@ -157,6 +157,11 @@ class MediaPart(PlexObject):
|
|||
streams.extend(items)
|
||||
return streams
|
||||
|
||||
@property
|
||||
def hasPreviewThumbnails(self):
|
||||
""" Returns True if the media part has generated preview (BIF) thumbnails. """
|
||||
return self.indexes == 'sd'
|
||||
|
||||
def videoStreams(self):
|
||||
""" Returns a list of :class:`~plexapi.media.VideoStream` objects in this MediaPart. """
|
||||
return [stream for stream in self.streams if isinstance(stream, VideoStream)]
|
||||
|
|
|
@ -340,6 +340,11 @@ class Movie(Video, Playable, AdvancedSettingsMixin, ArtMixin, PosterMixin, Split
|
|||
"""
|
||||
return [part.file for part in self.iterParts() if part]
|
||||
|
||||
@property
|
||||
def hasPreviewThumbnails(self):
|
||||
""" Returns True if any of the media parts has generated preview (BIF) thumbnails. """
|
||||
return any(part.hasPreviewThumbnails for media in self.media for part in media.parts)
|
||||
|
||||
def _prettyfilename(self):
|
||||
# This is just for compat.
|
||||
return self.title
|
||||
|
@ -857,6 +862,11 @@ class Episode(Video, Playable, ArtMixin, PosterMixin, CollectionMixin, DirectorM
|
|||
self.reload()
|
||||
return any(marker.type == 'intro' for marker in self.markers)
|
||||
|
||||
@property
|
||||
def hasPreviewThumbnails(self):
|
||||
""" Returns True if any of the media parts has generated preview (BIF) thumbnails. """
|
||||
return any(part.hasPreviewThumbnails for media in self.media for part in media.parts)
|
||||
|
||||
def season(self):
|
||||
"""" Return the episode's :class:`~plexapi.video.Season`. """
|
||||
return self.fetchItem(self.parentKey)
|
||||
|
|
Loading…
Reference in a new issue