Use media stream info for transcode decision (Fixes Tautulli/Tautulli-Issues#24)

This commit is contained in:
JonnyWong16 2018-03-14 19:45:47 -07:00
parent 5af1294f71
commit 8acdb5af83
2 changed files with 14 additions and 12 deletions

View file

@ -507,9 +507,9 @@ def build_media_notify_params(notify_action=None, session=None, timeline=None, m
user_stream_count = len(user_sessions) user_stream_count = len(user_sessions)
# Generate a combined transcode decision value # Generate a combined transcode decision value
if session.get('video_decision','') == 'transcode' or session.get('audio_decision','') == 'transcode': if session.get('stream_video_decision', '') == 'transcode' or session.get('stream_audio_decision', '') == 'transcode':
transcode_decision = 'Transcode' transcode_decision = 'Transcode'
elif session.get('video_decision','') == 'copy' or session.get('audio_decision','') == 'copy': elif session.get('stream_video_decision', '') == 'copy' or session.get('stream_audio_decision', '') == 'copy':
transcode_decision = 'Direct Stream' transcode_decision = 'Direct Stream'
else: else:
transcode_decision = 'Direct Play' transcode_decision = 'Direct Play'

View file

@ -1470,18 +1470,12 @@ class PmsConnect(object):
transcode_details['transcode_hw_decoding'] = int(transcode_details['transcode_hw_decode'].lower() in common.HW_DECODERS) transcode_details['transcode_hw_decoding'] = int(transcode_details['transcode_hw_decode'].lower() in common.HW_DECODERS)
transcode_details['transcode_hw_encoding'] = int(transcode_details['transcode_hw_encode'].lower() in common.HW_ENCODERS) transcode_details['transcode_hw_encoding'] = int(transcode_details['transcode_hw_encode'].lower() in common.HW_ENCODERS)
# Generate a combined transcode decision value
if transcode_details['video_decision'] == 'transcode' or transcode_details['audio_decision'] == 'transcode':
transcode_decision = 'transcode'
elif transcode_details['video_decision'] == 'copy' or transcode_details['audio_decision'] == 'copy':
transcode_decision = 'copy'
else:
transcode_decision = 'direct play'
# Determine if a synced version is being played # Determine if a synced version is being played
sync_id = None sync_id = None
if media_type not in ('photo', 'clip') and not session.getElementsByTagName('Session') \ if media_type not in ('photo', 'clip') \
and helpers.get_xml_attr(session, 'ratingKey').isdigit() and transcode_decision == 'direct play': and not session.getElementsByTagName('Session') \
and not session.getElementsByTagName('TranscodeSession') \
and helpers.get_xml_attr(session, 'ratingKey').isdigit():
plex_tv = plextv.PlexTV() plex_tv = plextv.PlexTV()
parent_rating_key = helpers.get_xml_attr(session, 'parentRatingKey') parent_rating_key = helpers.get_xml_attr(session, 'parentRatingKey')
grandparent_rating_key = helpers.get_xml_attr(session, 'grandparentRatingKey') grandparent_rating_key = helpers.get_xml_attr(session, 'grandparentRatingKey')
@ -1587,6 +1581,14 @@ class PmsConnect(object):
'stream_subtitle_decision': '' 'stream_subtitle_decision': ''
} }
# Generate a combined transcode decision value
if video_details['stream_video_decision'] == 'transcode' or audio_details['stream_audio_decision'] == 'transcode':
transcode_decision = 'transcode'
elif video_details['stream_video_decision'] == 'copy' or audio_details['stream_audio_decision'] == 'copy':
transcode_decision = 'copy'
else:
transcode_decision = 'direct play'
# Get the bif thumbnail # Get the bif thumbnail
indexes = helpers.get_xml_attr(stream_media_parts_info, 'indexes') indexes = helpers.get_xml_attr(stream_media_parts_info, 'indexes')
view_offset = helpers.get_xml_attr(session, 'viewOffset') view_offset = helpers.get_xml_attr(session, 'viewOffset')