mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-12 16:22:57 -07:00
Add audio quality profiles
This commit is contained in:
parent
00e281dfb7
commit
845c3d419a
4 changed files with 65 additions and 31 deletions
|
@ -163,6 +163,12 @@ DOCUMENTATION :: END
|
|||
Video <strong>Direct Play (${data['video_codec'].upper()} ${plexpy.common.VIDEO_RESOLUTION_OVERRIDES.get(data['video_resolution'], data['video_resolution'])})</strong>
|
||||
% endif
|
||||
<br />
|
||||
% elif data['media_type'] == 'photo':
|
||||
Video <strong>Direct Play (${data['width']}x${data['height']})</strong>
|
||||
<br />
|
||||
% else:
|
||||
Video <strong>None</strong>
|
||||
<br />
|
||||
% endif
|
||||
% if data['media_type'] in ('movie', 'episode', 'clip', 'track') and data['audio_codec']:
|
||||
% if data['audio_decision'] == 'transcode':
|
||||
|
@ -187,7 +193,7 @@ DOCUMENTATION :: END
|
|||
% else:
|
||||
Subtitle <strong>Direct Play (${data['subtitle_codec'].upper()})</strong>
|
||||
% endif
|
||||
% elif data['media_type'] != 'track':
|
||||
% else:
|
||||
Subtitle <strong>None</strong>
|
||||
% endif
|
||||
</div>
|
||||
|
@ -195,20 +201,23 @@ DOCUMENTATION :: END
|
|||
</div>
|
||||
<div class="dashboard-activity-terminate-bar">
|
||||
</div>
|
||||
% if data['media_type'] != 'photo':
|
||||
<div class="dashboard-activity-poster-info-bar">
|
||||
<div class="dashboard-activity-poster-info-ip-address">
|
||||
Quality:
|
||||
<span id="stream-quality-${data['session_key']}">
|
||||
${data['quality_profile'] if data['media_type'] != 'track' else ''}
|
||||
${data['quality_profile']}
|
||||
</span>
|
||||
<br />
|
||||
% if data['ip_address']:
|
||||
IP: ${data['ip_address']} (${data['location'].upper()} - <span id="stream-bandwidth-${data['session_key']}">${data['bandwidth']}</span> kbps)
|
||||
IP: ${data['ip_address']}
|
||||
% if data['media_type'] != 'photo' and 'location' in data:
|
||||
(${data['location'].upper()} - <span id="stream-bandwidth-${data['session_key']}">${data['bandwidth']}</span> kbps)
|
||||
% endif
|
||||
% else:
|
||||
IP: N/A
|
||||
% endif
|
||||
</div>
|
||||
% if data['media_type'] != 'photo':
|
||||
<div class="dashboard-activity-poster-info-time">
|
||||
ETA:
|
||||
<span id="stream-eta-${data['session_key']}">
|
||||
|
@ -225,8 +234,8 @@ DOCUMENTATION :: END
|
|||
</script>
|
||||
</span>
|
||||
</div>
|
||||
% endif
|
||||
</div>
|
||||
% endif
|
||||
</div>
|
||||
% if (data['media_type'] == 'movie' or data['media_type'] == 'episode' or data['media_type'] == 'track') and data['rating_key']:
|
||||
</a>
|
||||
|
@ -284,13 +293,13 @@ DOCUMENTATION :: END
|
|||
<a href="info?rating_key=${data['parent_rating_key']}" title="Season ${data['parent_media_index']}" class="text-muted">S${data['parent_media_index']}</a>
|
||||
· <a href="info?rating_key=${data['rating_key']}" title="Episode ${data['media_index']}" class="text-muted">E${data['media_index']}</a>
|
||||
% elif data['media_type'] == 'movie':
|
||||
<span title="${data['year']}">${data['year']}</span>
|
||||
<span title="${data['year']}" class="text-muted">${data['year']}</span>
|
||||
% elif data['media_type'] == 'track':
|
||||
<a href="info?rating_key=${data['parent_rating_key']}" title="${data['parent_title']}">${data['parent_title']}</a>
|
||||
<a href="info?rating_key=${data['parent_rating_key']}" title="${data['parent_title']}" class="text-muted">${data['parent_title']}</a>
|
||||
% elif data['media_type'] == 'photo':
|
||||
<span title="${data['title']}">${data['title']}</span>
|
||||
<span title="${data['title']}" class="text-muted">${data['title']}</span>
|
||||
% else:
|
||||
<span title="${data['year']}">${data['year']}</span>
|
||||
<span title="${data['year']}" class="text-muted">${data['year']}</span>
|
||||
% endif
|
||||
% endif
|
||||
</div>
|
||||
|
|
|
@ -292,7 +292,7 @@
|
|||
} else {
|
||||
ts += 'Stream <strong>Direct Play</strong><br>';
|
||||
}
|
||||
if (s.video_decision != '' && s.media_type != 'photo') {
|
||||
if (['movie', 'episode', 'clip'].indexOf(s.media_type) > -1 && s.video_decision != '') {
|
||||
switch (s.video_resolution.toLowerCase()) {
|
||||
case 'sd':
|
||||
var v_res = 'SD';
|
||||
|
@ -320,8 +320,12 @@
|
|||
} else {
|
||||
ts += 'Video <strong>Direct Play (' + s.video_codec.toUpperCase() + ' ' + v_res + ')</strong><br>';
|
||||
}
|
||||
} else if (s.media_type == 'photo') {
|
||||
ts += 'Video <strong>Direct Play (' + s.width + 'x' + s.height + ')</strong><br>';
|
||||
} else {
|
||||
ts += 'Video <strong>None</strong><br>';
|
||||
}
|
||||
if (s.audio_codec) {
|
||||
if (['movie', 'episode', 'clip', 'track'].indexOf(s.media_type) > -1 && s.audio_codec) {
|
||||
var a_codec = (s.audio_codec == 'truehd') ? 'TrueHD' : s.audio_codec.toUpperCase();
|
||||
var sa_codec = (s.stream_audio_codec == 'truehd') ? 'TrueHD' : s.stream_audio_codec.toUpperCase();
|
||||
if (s.audio_decision == 'transcode') {
|
||||
|
@ -335,7 +339,7 @@
|
|||
else {
|
||||
ts += 'Audio <strong>None</strong><br>';
|
||||
}
|
||||
if (s.subtitles) {
|
||||
if (['movie', 'episode', 'clip'].indexOf(s.media_type) > -1 && s.subtitles == '1') {
|
||||
if (s.subtitle_decision == 'transcode') {
|
||||
ts += 'Subtitle <strong>Transcode (' + s.subtitle_codec.toUpperCase() + ' → ' + s.stream_subtitle_codec.toUpperCase() + ')</strong>';
|
||||
} else if (s.subtitle_decision == 'copy') {
|
||||
|
@ -345,13 +349,13 @@
|
|||
} else {
|
||||
ts += 'Subtitle <strong>Direct Play (' + s.subtitle_codec.toUpperCase() + ')</strong>';
|
||||
}
|
||||
} else if (s.media_type != 'track') {
|
||||
} else {
|
||||
ts += 'Subtitle <strong>None</strong>';
|
||||
}
|
||||
$('#transcode-state-' + key).html(ts);
|
||||
|
||||
// update the stream quality profile and bandwidth
|
||||
$('#stream-quality-' + key).html((s.media_type != 'track') ? s.quality_profile : '');
|
||||
$('#stream-quality-' + key).html(s.quality_profile);
|
||||
$('#stream-bandwidth-' + key).html(s.bandwidth);
|
||||
|
||||
// update the stream progress times
|
||||
|
|
|
@ -75,20 +75,28 @@ AUDIO_CHANNELS = {'1': 'Mono',
|
|||
'8': '7.1'
|
||||
}
|
||||
|
||||
QUALITY_PROFILES = {20000: '20 Mbps 1080p',
|
||||
12000: '12 Mbps 1080p',
|
||||
10000: '10 Mbps 1080p',
|
||||
8000: '8 Mbps 1080p',
|
||||
4000: '4 Mbps 720p',
|
||||
3000: '3 Mbps 720p',
|
||||
2000: '2 Mbps 720p',
|
||||
1500: '1.5 Mbps 480p',
|
||||
720: '720 kbps',
|
||||
320: '320 kbps',
|
||||
208: '208 kbps',
|
||||
96: '96 kbps',
|
||||
64: '64 kbps'
|
||||
}
|
||||
VIDEO_QUALITY_PROFILES = {20000: '20 Mbps 1080p',
|
||||
12000: '12 Mbps 1080p',
|
||||
10000: '10 Mbps 1080p',
|
||||
8000: '8 Mbps 1080p',
|
||||
4000: '4 Mbps 720p',
|
||||
3000: '3 Mbps 720p',
|
||||
2000: '2 Mbps 720p',
|
||||
1500: '1.5 Mbps 480p',
|
||||
720: '720 kbps',
|
||||
320: '320 kbps',
|
||||
208: '208 kbps',
|
||||
96: '96 kbps',
|
||||
64: '64 kbps'
|
||||
}
|
||||
|
||||
AUDIO_QUALITY_PROFILES = {512: '512 kbps',
|
||||
320: '320 kbps',
|
||||
256: '256 kbps',
|
||||
192: '192 kbps',
|
||||
128: '128 kbps',
|
||||
96: '96 kbps'
|
||||
}
|
||||
|
||||
SCHEDULER_LIST = ['Check GitHub for updates',
|
||||
'Check for active sessions',
|
||||
|
|
|
@ -1509,13 +1509,26 @@ class PmsConnect(object):
|
|||
video_bitrate = helpers.cast_to_int(source_video_details.get('video_bitrate'))
|
||||
|
||||
try:
|
||||
quailtiy_bitrate = min(b for b in common.QUALITY_PROFILES if stream_video_bitrate <= b <= video_bitrate)
|
||||
quality_profile = common.QUALITY_PROFILES[quailtiy_bitrate]
|
||||
quailtiy_bitrate = min(b for b in common.VIDEO_QUALITY_PROFILES if stream_video_bitrate <= b <= video_bitrate)
|
||||
quality_profile = common.VIDEO_QUALITY_PROFILES[quailtiy_bitrate]
|
||||
except ValueError:
|
||||
quality_profile = 'Original'
|
||||
|
||||
elif media_type == 'track' and 'stream_audio_bitrate' in audio_details:
|
||||
stream_audio_bitrate = helpers.cast_to_int(audio_details['stream_audio_bitrate'])
|
||||
audio_bitrate = helpers.cast_to_int(source_audio_details['audio_bitrate'])
|
||||
|
||||
try:
|
||||
quailtiy_bitrate = min(b for b in common.AUDIO_QUALITY_PROFILES if stream_audio_bitrate <= b <= audio_bitrate)
|
||||
quality_profile = common.AUDIO_QUALITY_PROFILES[quailtiy_bitrate]
|
||||
except ValueError:
|
||||
quality_profile = 'Original'
|
||||
|
||||
elif media_type == 'photo':
|
||||
quality_profile = 'Original'
|
||||
|
||||
else:
|
||||
quality_profile = ''
|
||||
quality_profile = 'Unknown'
|
||||
|
||||
# Entire session output (single dict for backwards compatibility)
|
||||
session_output = {'session_key': helpers.get_xml_attr(session, 'sessionKey'),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue