Add Chapters to Track (#1134)

Audiobooks in m4b containers support chapters as meta data. These are provided in the XML, but not included in the Track Object of the plexapi
This commit is contained in:
micha91 2023-05-24 21:04:03 +02:00 committed by GitHub
parent b4c463aff8
commit 4946b4bc8b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -372,6 +372,7 @@ class Track(
Attributes:
TAG (str): 'Directory'
TYPE (str): 'track'
chapters (List<:class:`~plexapi.media.Chapter`>): List of Chapter objects.
chapterSource (str): Unknown
collections (List<:class:`~plexapi.media.Collection`>): List of collection objects.
duration (int): Length of the track in milliseconds.
@ -407,6 +408,7 @@ class Track(
""" Load attribute values from Plex XML response. """
Audio._loadData(self, data)
Playable._loadData(self, data)
self.chapters = self.findItems(data, media.Chapter)
self.chapterSource = data.attrib.get('chapterSource')
self.collections = self.findItems(data, media.Collection)
self.duration = utils.cast(int, data.attrib.get('duration'))