|
10 | 10 | class Video(PlexPartialObject): |
11 | 11 | """ Base class for all video objects including :class:`~plexapi.video.Movie`, |
12 | 12 | :class:`~plexapi.video.Show`, :class:`~plexapi.video.Season`, |
13 | | - :class:`~plexapi.video.Episode`. |
| 13 | + :class:`~plexapi.video.Episode`, :class:`~plexapi.video.Clip`. |
14 | 14 |
|
15 | 15 | Attributes: |
16 | 16 | addedAt (datetime): Datetime this item was added to the library. |
@@ -774,24 +774,38 @@ def _defaultSyncTitle(self): |
774 | 774 |
|
775 | 775 | @utils.registerPlexObject |
776 | 776 | class Clip(Playable, Video): |
777 | | - """ Represents a single Clip.""" |
| 777 | + """Represents a single Clip. |
| 778 | +
|
| 779 | + Attributes: |
| 780 | + TAG (str): 'Video' |
| 781 | + TYPE (str): 'clip' |
| 782 | + duration (int): Duration of movie in milliseconds. |
| 783 | + extraType (int): Unknown |
| 784 | + guid: Plex GUID (com.plexapp.agents.imdb://tt4302938?lang=en). |
| 785 | + index (int): Plex index (?) |
| 786 | + originallyAvailableAt (datetime): Datetime movie was released. |
| 787 | + subtype (str): Type of clip |
| 788 | + viewOffset (int): View offset in milliseconds. |
| 789 | + """ |
778 | 790 |
|
779 | 791 | TAG = 'Video' |
780 | 792 | TYPE = 'clip' |
781 | 793 | METADATA_TYPE = 'clip' |
782 | 794 |
|
783 | 795 | def _loadData(self, data): |
784 | | - self._data = data |
785 | | - self.addedAt = data.attrib.get('addedAt') |
786 | | - self.duration = data.attrib.get('duration') |
| 796 | + """Load attribute values from Plex XML response.""" |
| 797 | + Video._loadData(self, data) |
| 798 | + Playable._loadData(self, data) |
| 799 | + self.duration = utils.cast(int, data.attrib.get('duration')) |
| 800 | + self.extraType = utils.cast(int, data.attrib.get('extraType')) |
787 | 801 | self.guid = data.attrib.get('guid') |
788 | | - self.key = data.attrib.get('key') |
| 802 | + self.index = utils.cast(int, data.attrib.get('index')) |
789 | 803 | self.originallyAvailableAt = data.attrib.get('originallyAvailableAt') |
790 | | - self.ratingKey = data.attrib.get('ratingKey') |
791 | | - self.skipDetails = utils.cast(int, data.attrib.get('skipDetails')) |
792 | 804 | self.subtype = data.attrib.get('subtype') |
793 | | - self.thumb = data.attrib.get('thumb') |
794 | | - self.thumbAspectRatio = data.attrib.get('thumbAspectRatio') |
795 | | - self.title = data.attrib.get('title') |
796 | | - self.type = data.attrib.get('type') |
797 | | - self.year = data.attrib.get('year') |
| 805 | + self.viewOffset = utils.cast(int, data.attrib.get('viewOffset', 0)) |
| 806 | + |
| 807 | + def section(self): |
| 808 | + """Return the :class:`~plexapi.library.LibrarySection` this item belongs to.""" |
| 809 | + # Clip payloads currently do not contain 'librarySectionID'. |
| 810 | + # Return None to avoid unnecessary attribute lookup attempts. |
| 811 | + return None |
0 commit comments