mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-30 03:28:31 -07:00
Add plexapi.media.Marker to plexapi.video.Episode
This commit is contained in:
parent
352dbd9bc8
commit
c4ac03738b
2 changed files with 29 additions and 0 deletions
|
@ -821,6 +821,27 @@ class Chapter(PlexObject):
|
||||||
self.end = cast(int, data.attrib.get('endTimeOffset'))
|
self.end = cast(int, data.attrib.get('endTimeOffset'))
|
||||||
|
|
||||||
|
|
||||||
|
@utils.registerPlexObject
|
||||||
|
class Marker(PlexObject):
|
||||||
|
""" Represents a single Marker media tag.
|
||||||
|
Attributes:
|
||||||
|
TAG (str): 'Marker'
|
||||||
|
"""
|
||||||
|
TAG = 'Marker'
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
name = self._clean(self.firstAttr('type'))
|
||||||
|
start = utils.millisecondToHumanstr(self._clean(self.firstAttr('start')))
|
||||||
|
end = utils.millisecondToHumanstr(self._clean(self.firstAttr('end')))
|
||||||
|
return '<%s:%s %s - %s>' % (self.__class__.__name__, name, start, end)
|
||||||
|
|
||||||
|
def _loadData(self, data):
|
||||||
|
self._data = data
|
||||||
|
self.type = data.attrib.get('type')
|
||||||
|
self.start = cast(int, data.attrib.get('startTimeOffset'))
|
||||||
|
self.end = cast(int, data.attrib.get('endTimeOffset'))
|
||||||
|
|
||||||
|
|
||||||
@utils.registerPlexObject
|
@utils.registerPlexObject
|
||||||
class Field(PlexObject):
|
class Field(PlexObject):
|
||||||
""" Represents a single Field.
|
""" Represents a single Field.
|
||||||
|
|
|
@ -699,6 +699,7 @@ class Episode(Playable, Video):
|
||||||
self.labels = self.findItems(data, media.Label)
|
self.labels = self.findItems(data, media.Label)
|
||||||
self.collections = self.findItems(data, media.Collection)
|
self.collections = self.findItems(data, media.Collection)
|
||||||
self.chapters = self.findItems(data, media.Chapter)
|
self.chapters = self.findItems(data, media.Chapter)
|
||||||
|
self.markers = self.findItems(data, media.Marker)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return '<%s>' % ':'.join([p for p in [
|
return '<%s>' % ':'.join([p for p in [
|
||||||
|
@ -730,6 +731,13 @@ class Episode(Playable, Video):
|
||||||
""" Returns the s00e00 string containing the season and episode. """
|
""" Returns the s00e00 string containing the season and episode. """
|
||||||
return 's%se%s' % (str(self.seasonNumber).zfill(2), str(self.index).zfill(2))
|
return 's%se%s' % (str(self.seasonNumber).zfill(2), str(self.index).zfill(2))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def hasIntroMarker(self):
|
||||||
|
""" Returns True if this episode has an intro marker in the xml. """
|
||||||
|
if not self.isFullObject():
|
||||||
|
self.reload()
|
||||||
|
return any(marker.type == 'intro' for marker in self.markers)
|
||||||
|
|
||||||
def season(self):
|
def season(self):
|
||||||
"""" Return this episodes :func:`~plexapi.video.Season`.. """
|
"""" Return this episodes :func:`~plexapi.video.Season`.. """
|
||||||
return self.fetchItem(self.parentKey)
|
return self.fetchItem(self.parentKey)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue