Refactor usage of a media part's id
This commit is contained in:
parent
63bd85d5c8
commit
887f659b2f
2 changed files with 9 additions and 10 deletions
|
@ -329,19 +329,12 @@ def audio_subtitle_prefs(api, item):
|
||||||
Returns None if user cancelled or we need to abort, True otherwise
|
Returns None if user cancelled or we need to abort, True otherwise
|
||||||
"""
|
"""
|
||||||
# Set media and part where we're at
|
# Set media and part where we're at
|
||||||
if (api.mediastream is None and
|
if api.mediastream is None and api.mediastream_number() is None:
|
||||||
api.mediastream_number() is None):
|
|
||||||
return
|
return
|
||||||
try:
|
|
||||||
mediastreams = api.plex_media_streams()
|
|
||||||
except (TypeError, IndexError):
|
|
||||||
LOG.error('Could not get media %s, part %s',
|
|
||||||
api.mediastream, api.part)
|
|
||||||
return
|
|
||||||
part_id = mediastreams.attrib['id']
|
|
||||||
if item.playmethod != v.PLAYBACK_METHOD_TRANSCODE:
|
if item.playmethod != v.PLAYBACK_METHOD_TRANSCODE:
|
||||||
return True
|
return True
|
||||||
return setup_transcoding_audio_subtitle_prefs(mediastreams, part_id)
|
return setup_transcoding_audio_subtitle_prefs(api.plex_media_streams(),
|
||||||
|
api.part_id())
|
||||||
|
|
||||||
|
|
||||||
def setup_transcoding_audio_subtitle_prefs(mediastreams, part_id):
|
def setup_transcoding_audio_subtitle_prefs(mediastreams, part_id):
|
||||||
|
|
|
@ -256,6 +256,12 @@ class Base(object):
|
||||||
"""
|
"""
|
||||||
return self.xml[self.mediastream][self.part]
|
return self.xml[self.mediastream][self.part]
|
||||||
|
|
||||||
|
def part_id(self):
|
||||||
|
"""
|
||||||
|
Returns the unique id of the currently active part [int]
|
||||||
|
"""
|
||||||
|
return int(self.xml[self.mediastream][self.part].attrib['id'])
|
||||||
|
|
||||||
def plot(self):
|
def plot(self):
|
||||||
"""
|
"""
|
||||||
Returns the plot or None.
|
Returns the plot or None.
|
||||||
|
|
Loading…
Reference in a new issue