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