mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-26 10:46:11 +00:00
playutils: Prettify audio/subs track selection dialog
* Capitalize language in the track title * Capitalize channel layout in the track title (e.g. 'Stereo') * Remove track index from the title - users generally don't care what the # is * Use commercial names for the audio codecs (e.g. 'Dolby Digital' instead of 'ac3') * Always show codec name for subtitle tracks
This commit is contained in:
parent
b66a838778
commit
4312135524
1 changed files with 25 additions and 6 deletions
|
@ -526,6 +526,23 @@ class PlayUtils(object):
|
||||||
|
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
def get_commercial_codec_name(self, codec, profile):
|
||||||
|
NAMES = {
|
||||||
|
'ac3': 'Dolby Digital',
|
||||||
|
'eac3': 'Dolby Digital+',
|
||||||
|
'truehd': 'Dolby TrueHD',
|
||||||
|
'dts': 'DTS'
|
||||||
|
}
|
||||||
|
|
||||||
|
if profile == 'DTS-HD MA':
|
||||||
|
return 'DTS-HD Master Audio'
|
||||||
|
if profile == 'DTS-HD HRA':
|
||||||
|
return 'DTS-HD High Resolution Audio'
|
||||||
|
if codec in NAMES:
|
||||||
|
return NAMES[codec]
|
||||||
|
|
||||||
|
return codec.upper()
|
||||||
|
|
||||||
def get_audio_subs(self, source, audio=None, subtitle=None):
|
def get_audio_subs(self, source, audio=None, subtitle=None):
|
||||||
|
|
||||||
''' For transcoding only
|
''' For transcoding only
|
||||||
|
@ -546,22 +563,24 @@ class PlayUtils(object):
|
||||||
|
|
||||||
if stream_type == 'Audio':
|
if stream_type == 'Audio':
|
||||||
|
|
||||||
codec = stream['Codec']
|
profile = stream['Profile'] if 'Profile' in stream else None
|
||||||
channel = stream.get('ChannelLayout', "")
|
codec = self.get_commercial_codec_name(stream['Codec'], profile)
|
||||||
|
channel = stream.get('ChannelLayout', "").capitalize()
|
||||||
|
|
||||||
if 'Language' in stream:
|
if 'Language' in stream:
|
||||||
track = "%s - %s - %s %s" % (index, stream['Language'], codec, channel)
|
track = "%s - %s %s" % (stream['Language'].capitalize(), codec, channel)
|
||||||
else:
|
else:
|
||||||
track = "%s - %s %s" % (index, codec, channel)
|
track = "%s %s" % (codec, channel)
|
||||||
|
|
||||||
audio_streams[track] = index
|
audio_streams[track] = index
|
||||||
|
|
||||||
elif stream_type == 'Subtitle':
|
elif stream_type == 'Subtitle':
|
||||||
|
codec = self.get_commercial_codec_name(stream['Codec'], None)
|
||||||
|
|
||||||
if 'Language' in stream:
|
if 'Language' in stream:
|
||||||
track = "%s - %s" % (index, stream['Language'])
|
track = "%s - %s" % (stream['Language'].capitalize(), codec)
|
||||||
else:
|
else:
|
||||||
track = "%s - %s" % (index, stream['Codec'])
|
track = "%s" % codec
|
||||||
|
|
||||||
if stream['IsDefault']:
|
if stream['IsDefault']:
|
||||||
track = "%s - Default" % track
|
track = "%s - Default" % track
|
||||||
|
|
Loading…
Reference in a new issue