RemiRigal / Plex-Auto-Languages

Automated language selection for Plex TV Shows !
MIT License
428 stars 16 forks source link

Removed problematic comparisons with AudioStream and SubtitleStream. #5

Closed mcpowell87 closed 2 years ago

mcpowell87 commented 2 years ago

AudioStreams were being compared by title, which is not part of that object. SubtitleStreams were being compared by title and codec, both of which are not part of the object.

I was using the following guide as a reference Python PlexAPI Doc

I tested this locally by changing both the audio stream and subtitle and saw the intended behavior of subtitles/audio being set for the show, so I think this should resolve issue #4

RemiRigal commented 2 years ago

Thank you @mcpowell87 for the PR. The AudioStream and SubtitleStream classes both inherits from the base class MediaPartStream which have the attributes title and codec, see here.

Here is an example of the command vars(subtitle) in Python:

{'_server': <PlexServer:http://****/>,
 '_data': <Element 'Stream' at 0x7fc77a2e7540>,
 '_initpath': '/library/metadata/28669',
 '_parent': <weakref at 0x7fc77a278540; to 'MediaPart' at 0x7fc77ad30250>,
 '_details_key': None,
 'bitrate': 0,
 'codec': 'srt',
 'default': True,
 'displayTitle': 'Français Forced (SRT)',
 'extendedDisplayTitle': 'French [Forced] (Français SRT)',
 'key': None,
 'id': 186482,
 'index': 3,
 'language': 'Français',
 'languageCode': 'fra',
 'requiredBandwidths': None,
 'selected': False,
 'streamType': 3,
 'title': 'French [Forced]',
 'type': 3,
 'container': None,
 'forced': True,
 'format': None,
 'headerCompression': None,
 'transient': None,
 '_autoReload': False,
 '_edits': None}

However you are right for pointing issues on those lines:

RemiRigal commented 2 years ago

I'm closing this PR as the fixes have been merged in #7, thank you for bringing attention to the issue !