mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Merge pull request #2788 from ThatNerdyPikachu/more-track-titles
Use embedded title for other track types
This commit is contained in:
commit
83509e99cb
@ -112,18 +112,20 @@ namespace MediaBrowser.Model.Entities
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (Type == MediaStreamType.Audio)
|
switch (Type)
|
||||||
|
{
|
||||||
|
case MediaStreamType.Audio:
|
||||||
{
|
{
|
||||||
// if (!string.IsNullOrEmpty(Title))
|
|
||||||
//{
|
|
||||||
// return AddLanguageIfNeeded(Title);
|
|
||||||
//}
|
|
||||||
|
|
||||||
var attributes = new List<string>();
|
var attributes = new List<string>();
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Language))
|
if (!string.IsNullOrEmpty(Language))
|
||||||
{
|
{
|
||||||
attributes.Add(StringHelper.FirstToUpper(Language));
|
// Get full language string i.e. eng -> English. Will not work for some languages which use ISO 639-2/B instead of /T codes.
|
||||||
|
string fullLanguage = CultureInfo
|
||||||
|
.GetCultures(CultureTypes.NeutralCultures)
|
||||||
|
.FirstOrDefault(r => r.ThreeLetterISOLanguageName.Equals(Language, StringComparison.OrdinalIgnoreCase))
|
||||||
|
?.DisplayName;
|
||||||
|
attributes.Add(StringHelper.FirstToUpper(fullLanguage ?? Language));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Codec) && !string.Equals(Codec, "dca", StringComparison.OrdinalIgnoreCase))
|
if (!string.IsNullOrEmpty(Codec) && !string.Equals(Codec, "dca", StringComparison.OrdinalIgnoreCase))
|
||||||
@ -137,7 +139,7 @@ namespace MediaBrowser.Model.Entities
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(ChannelLayout))
|
if (!string.IsNullOrEmpty(ChannelLayout))
|
||||||
{
|
{
|
||||||
attributes.Add(ChannelLayout);
|
attributes.Add(StringHelper.FirstToUpper(ChannelLayout));
|
||||||
}
|
}
|
||||||
else if (Channels.HasValue)
|
else if (Channels.HasValue)
|
||||||
{
|
{
|
||||||
@ -146,13 +148,28 @@ namespace MediaBrowser.Model.Entities
|
|||||||
|
|
||||||
if (IsDefault)
|
if (IsDefault)
|
||||||
{
|
{
|
||||||
attributes.Add("Default");
|
attributes.Add(string.IsNullOrEmpty(localizedDefault) ? "Default" : localizedDefault);
|
||||||
}
|
}
|
||||||
|
|
||||||
return string.Join(" ", attributes);
|
if (!string.IsNullOrEmpty(Title))
|
||||||
|
{
|
||||||
|
var result = new StringBuilder(Title);
|
||||||
|
foreach (var tag in attributes)
|
||||||
|
{
|
||||||
|
// Keep Tags that are not already in Title.
|
||||||
|
if (Title.IndexOf(tag, StringComparison.OrdinalIgnoreCase) == -1)
|
||||||
|
{
|
||||||
|
result.Append(" - ").Append(tag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Type == MediaStreamType.Video)
|
return result.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
return string.Join(" - ", attributes);
|
||||||
|
}
|
||||||
|
|
||||||
|
case MediaStreamType.Video:
|
||||||
{
|
{
|
||||||
var attributes = new List<string>();
|
var attributes = new List<string>();
|
||||||
|
|
||||||
@ -168,17 +185,36 @@ namespace MediaBrowser.Model.Entities
|
|||||||
attributes.Add(Codec.ToUpperInvariant());
|
attributes.Add(Codec.ToUpperInvariant());
|
||||||
}
|
}
|
||||||
|
|
||||||
return string.Join(" ", attributes);
|
if (!string.IsNullOrEmpty(Title))
|
||||||
|
{
|
||||||
|
var result = new StringBuilder(Title);
|
||||||
|
foreach (var tag in attributes)
|
||||||
|
{
|
||||||
|
// Keep Tags that are not already in Title.
|
||||||
|
if (Title.IndexOf(tag, StringComparison.OrdinalIgnoreCase) == -1)
|
||||||
|
{
|
||||||
|
result.Append(" - ").Append(tag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Type == MediaStreamType.Subtitle)
|
return result.ToString();
|
||||||
{
|
}
|
||||||
|
|
||||||
|
return string.Join(' ', attributes);
|
||||||
|
}
|
||||||
|
|
||||||
|
case MediaStreamType.Subtitle:
|
||||||
|
{
|
||||||
var attributes = new List<string>();
|
var attributes = new List<string>();
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Language))
|
if (!string.IsNullOrEmpty(Language))
|
||||||
{
|
{
|
||||||
attributes.Add(StringHelper.FirstToUpper(Language));
|
// Get full language string i.e. eng -> English. Will not work for some languages which use ISO 639-2/B instead of /T codes.
|
||||||
|
string fullLanguage = CultureInfo
|
||||||
|
.GetCultures(CultureTypes.NeutralCultures)
|
||||||
|
.FirstOrDefault(r => r.ThreeLetterISOLanguageName.Equals(Language, StringComparison.OrdinalIgnoreCase))
|
||||||
|
?.DisplayName;
|
||||||
|
attributes.Add(StringHelper.FirstToUpper(fullLanguage ?? Language));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -197,24 +233,27 @@ namespace MediaBrowser.Model.Entities
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(Title))
|
if (!string.IsNullOrEmpty(Title))
|
||||||
{
|
{
|
||||||
return attributes.AsEnumerable()
|
var result = new StringBuilder(Title);
|
||||||
// keep Tags that are not already in Title
|
foreach (var tag in attributes)
|
||||||
.Where(tag => Title.IndexOf(tag, StringComparison.OrdinalIgnoreCase) == -1)
|
{
|
||||||
// attributes concatenation, starting with Title
|
// Keep Tags that are not already in Title.
|
||||||
.Aggregate(new StringBuilder(Title), (builder, attr) => builder.Append(" - ").Append(attr))
|
if (Title.IndexOf(tag, StringComparison.OrdinalIgnoreCase) == -1)
|
||||||
.ToString();
|
{
|
||||||
|
result.Append(" - ").Append(tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
return string.Join(" - ", attributes.ToArray());
|
return string.Join(" - ", attributes.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Type == MediaStreamType.Video)
|
default:
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private string GetResolutionText()
|
private string GetResolutionText()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user