Skip to content

Update to MediaPartStream and inheriting classes - #590

Merged
jjlawren merged 40 commits into
masterfrom
mediaSubtitle_attribs
Jan 24, 2021
Merged

jjlawren merged 40 commits into
masterfrom
mediaSubtitle_attribs

Conversation

@blacktwin

@blacktwin blacktwin commented Oct 23, 2020 •

Copy link
Copy Markdown
Collaborator

Description

Clean up of MediaPartStream and it's inheriting classes (video, audio, subtitle).
Moving common attribs among video, audio, and subtitle streams into parent MediaPartStream.
Removal of no longer present attribs from video, audio, subtitle, and MediaPartStream.

Addresses #536

Type of change

  • Bug fix (non-breaking change which fixes an issue)
    Technically not a bug fix, but code clean up.

@JonnyWong16 JonnyWong16 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have also added the following attributes to my forked plexapi-3.6.0:

~plexapi.media.Media

        self.audioProfile = data.attrib.get('videoProfile')
        self.proxyType = cast(int, data.attrib.get('proxyType'))
        self.optimizedVersion = self.proxyType == SEARCHTYPES['optimizedVersion']

        # For Photo only
        self.aperture = data.attrib.get('aperture')
        self.exposure = data.attrib.get('exposure')
        self.iso = cast(int, data.attrib.get('iso'))
        self.lens = data.attrib.get('lens')
        self.make = data.attrib.get('make')
        self.model = data.attrib.get('model')

~plexapi.media.MediaPart

        self.audioProfile = data.attrib.get('audioProfile')
        self.deepAnalysisVersion = cast(int, data.attrib.get('deepAnalysisVersion'))
        self.has64bitOffsets = cast(bool, data.attrib.get('has64bitOffsets'))
        self.hasThumbnail = cast(bool, data.attrib.get('hasThumbnail'))
        self.packetLength = cast(int, data.attrib.get('packetLength'))
        self.requiredBandwidths = data.attrib.get('requiredBandwidths')

~plexapi.media.VideoStream

        self.anamorphic = data.attrib.get('anamorphic')
        self.chromaLocation = data.attrib.get('chromaLocation')
        self.DOVIBLCompatID = cast(int, data.attrib.get('DOVIBLCompatID'))
        self.DOVIBLPresent = cast(bool, data.attrib.get('DOVIBLPresent'))
        self.DOVIELPresent = cast(bool, data.attrib.get('DOVIELPresent'))
        self.DOVILevel = cast(int, data.attrib.get('DOVILevel'))
        self.DOVIPresent = cast(bool, data.attrib.get('DOVIPresent'))
        self.DOVIProfile = cast(int, data.attrib.get('DOVIProfile'))
        self.DOVIRPUPresent = cast(bool, data.attrib.get('DOVIRPUPresent'))
        self.DOVIVersion = cast(float, data.attrib.get('DOVIVersion'))
        self.pixelAspectRatio = data.attrib.get('pixelAspectRatio')
        self.pixelFormat = data.attrib.get('pixelFormat')
        self.streamIdentifier = cast(int, data.attrib.get('streamIdentifier'))

~plexapi.media.AudioStream

        self.profile = data.attrib.get('profile')

        # For Track only
        self.albumGain = cast(float, data.attrib.get('albumGain'))
        self.albumPeak = cast(float, data.attrib.get('albumPeak'))
        self.albumRange = cast(float, data.attrib.get('albumRange'))
        self.endRamp = data.attrib.get('endRamp')
        self.gain = cast(float, data.attrib.get('gain'))
        self.loudness = cast(float, data.attrib.get('loudness'))
        self.lra = cast(float, data.attrib.get('lra'))
        self.peak = cast(float, data.attrib.get('peak'))
        self.startRamp = data.attrib.get('startRamp')

~plexapi.media.SubtitleStream

        self.container = data.attrib.get('container')
        self.forced = cast(bool, data.attrib.get('forced', '0'))
        self.format = data.attrib.get('format')
        self.headerCompression = data.attrib.get('headerCompression')

~plexapi.media.LyricStream (STREAMTYPE = 4)

        self.format = data.attrib.get('format')
        self.minLines = cast(int, data.attrib.get('minLines'))
        self.provider = data.attrib.get('provider')
        self.timed = cast(bool, data.attrib.get('timed', '0'))

Comment thread plexapi/media.py
@blacktwin
blacktwin force-pushed the mediaSubtitle_attribs branch from 51588ff to 13d9273 Compare November 26, 2020 04:58

@JonnyWong16 JonnyWong16 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Update doc strings.

Comment thread plexapi/media.py Outdated
Comment thread plexapi/media.py Outdated
Comment thread plexapi/media.py Outdated
Comment thread plexapi/media.py
Comment thread plexapi/media.py Outdated
Comment thread plexapi/media.py
Comment thread plexapi/media.py Outdated
Comment thread plexapi/media.py
@JonnyWong16

Copy link
Copy Markdown
Collaborator

Cherrypick this commit.
JonnyWong16@e346f0b

@JonnyWong16
JonnyWong16 force-pushed the mediaSubtitle_attribs branch from f76b129 to 2f5ba49 Compare January 17, 2021 01:02
Comment thread plexapi/media.py
@JonnyWong16

Copy link
Copy Markdown
Collaborator

Tests have been updated with the new attributes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants