Skip to content

Commit 5050686

Browse files
committed
Remove isChildOf check for photo and track attributes
1 parent e35c6bc commit 5050686

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

plexapi/media.py

+19-19
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class Media(PlexObject):
3737
videoResolution (str): The video resolution of the media (ex: sd).
3838
width (int): The width of the video in pixels (ex: 608).
3939
40-
<Photo_only_attributes>: The following attributes are only available for photos.
40+
Photo_only_attributes: The following attributes are only available for photos.
4141
4242
* aperture (str): The aperture used to take the photo.
4343
* exposure (str): The exposure used to take the photo.
@@ -74,13 +74,13 @@ def _loadData(self, data):
7474
self.width = utils.cast(int, data.attrib.get('width'))
7575
self.uuid = data.attrib.get('uuid')
7676

77-
if self._isChildOf(etag='Photo'):
78-
self.aperture = data.attrib.get('aperture')
79-
self.exposure = data.attrib.get('exposure')
80-
self.iso = utils.cast(int, data.attrib.get('iso'))
81-
self.lens = data.attrib.get('lens')
82-
self.make = data.attrib.get('make')
83-
self.model = data.attrib.get('model')
77+
# Photo only attributes
78+
self.aperture = data.attrib.get('aperture')
79+
self.exposure = data.attrib.get('exposure')
80+
self.iso = utils.cast(int, data.attrib.get('iso'))
81+
self.lens = data.attrib.get('lens')
82+
self.make = data.attrib.get('make')
83+
self.model = data.attrib.get('model')
8484

8585
parent = self._parent()
8686
self._parentKey = parent.key
@@ -381,7 +381,7 @@ class AudioStream(MediaPartStream):
381381
samplingRate (int): The sampling rate of the audio stream (ex: xxx)
382382
streamIdentifier (int): The stream identifier of the audio stream.
383383
384-
<Track_only_attributes>: The following attributes are only available for tracks.
384+
Track_only_attributes: The following attributes are only available for tracks.
385385
386386
* albumGain (float): The gain for the album.
387387
* albumPeak (float): The peak for the album.
@@ -408,16 +408,16 @@ def _loadData(self, data):
408408
self.samplingRate = utils.cast(int, data.attrib.get('samplingRate'))
409409
self.streamIdentifier = utils.cast(int, data.attrib.get('streamIdentifier'))
410410

411-
if self._isChildOf(etag='Track'):
412-
self.albumGain = utils.cast(float, data.attrib.get('albumGain'))
413-
self.albumPeak = utils.cast(float, data.attrib.get('albumPeak'))
414-
self.albumRange = utils.cast(float, data.attrib.get('albumRange'))
415-
self.endRamp = data.attrib.get('endRamp')
416-
self.gain = utils.cast(float, data.attrib.get('gain'))
417-
self.loudness = utils.cast(float, data.attrib.get('loudness'))
418-
self.lra = utils.cast(float, data.attrib.get('lra'))
419-
self.peak = utils.cast(float, data.attrib.get('peak'))
420-
self.startRamp = data.attrib.get('startRamp')
411+
# Track only attributes
412+
self.albumGain = utils.cast(float, data.attrib.get('albumGain'))
413+
self.albumPeak = utils.cast(float, data.attrib.get('albumPeak'))
414+
self.albumRange = utils.cast(float, data.attrib.get('albumRange'))
415+
self.endRamp = data.attrib.get('endRamp')
416+
self.gain = utils.cast(float, data.attrib.get('gain'))
417+
self.loudness = utils.cast(float, data.attrib.get('loudness'))
418+
self.lra = utils.cast(float, data.attrib.get('lra'))
419+
self.peak = utils.cast(float, data.attrib.get('peak'))
420+
self.startRamp = data.attrib.get('startRamp')
421421

422422
def setSelected(self):
423423
""" Sets this audio stream as the selected audio stream.

0 commit comments

Comments
 (0)