Skip to content

Commit 607d4b0

Browse files
committed
Add album format and subformat tags
1 parent 118717e commit 607d4b0

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

plexapi/audio.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ class Album(Audio, ArtMixin, PosterMixin, RatingMixin, UnmatchMatchMixin,
234234
TAG (str): 'Directory'
235235
TYPE (str): 'album'
236236
collections (List<:class:`~plexapi.media.Collection`>): List of collection objects.
237+
formats (List<:class:`~plexapi.media.Format`>): List of format objects.
237238
genres (List<:class:`~plexapi.media.Genre`>): List of genre objects.
238239
key (str): API URL (/library/metadata/<ratingkey>).
239240
labels (List<:class:`~plexapi.media.Label`>): List of label objects.
@@ -248,6 +249,7 @@ class Album(Audio, ArtMixin, PosterMixin, RatingMixin, UnmatchMatchMixin,
248249
rating (float): Album rating (7.9; 9.8; 8.1).
249250
studio (str): Studio that released the album.
250251
styles (List<:class:`~plexapi.media.Style`>): List of style objects.
252+
subformats (List<:class:`~plexapi.media.Subformat`>): List of subformat objects.
251253
viewedLeafCount (int): Number of items marked as played in the album view.
252254
year (int): Year the album was released.
253255
"""
@@ -258,6 +260,7 @@ def _loadData(self, data):
258260
""" Load attribute values from Plex XML response. """
259261
Audio._loadData(self, data)
260262
self.collections = self.findItems(data, media.Collection)
263+
self.formats = self.findItems(data, media.Format)
261264
self.genres = self.findItems(data, media.Genre)
262265
self.key = self.key.replace('/children', '') # FIX_BUG_50
263266
self.labels = self.findItems(data, media.Label)
@@ -272,6 +275,7 @@ def _loadData(self, data):
272275
self.rating = utils.cast(float, data.attrib.get('rating'))
273276
self.studio = data.attrib.get('studio')
274277
self.styles = self.findItems(data, media.Style)
278+
self.subformats = self.findItems(data, media.Subformat)
275279
self.viewedLeafCount = utils.cast(int, data.attrib.get('viewedLeafCount'))
276280
self.year = utils.cast(int, data.attrib.get('year'))
277281

plexapi/media.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,18 @@ class Director(MediaTag):
731731
FILTER = 'director'
732732

733733

734+
@utils.registerPlexObject
735+
class Format(MediaTag):
736+
""" Represents a single Format media tag.
737+
738+
Attributes:
739+
TAG (str): 'Format'
740+
FILTER (str): 'format'
741+
"""
742+
TAG = 'Format'
743+
FILTER = 'format'
744+
745+
734746
@utils.registerPlexObject
735747
class Genre(MediaTag):
736748
""" Represents a single Genre media tag.
@@ -815,6 +827,18 @@ class Style(MediaTag):
815827
FILTER = 'style'
816828

817829

830+
@utils.registerPlexObject
831+
class Subformat(MediaTag):
832+
""" Represents a single Subformat media tag.
833+
834+
Attributes:
835+
TAG (str): 'Subformat'
836+
FILTER (str): 'subformat'
837+
"""
838+
TAG = 'Subformat'
839+
FILTER = 'subformat'
840+
841+
818842
@utils.registerPlexObject
819843
class Tag(MediaTag):
820844
""" Represents a single Tag media tag.

0 commit comments

Comments
 (0)