mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-16 05:53:03 +03:00
Change subtitles DisplayTitle behavior
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
using MediaBrowser.Model.Extensions;
|
||||
using MediaBrowser.Model.MediaInfo;
|
||||
@@ -65,6 +67,10 @@ namespace MediaBrowser.Model.Entities
|
||||
}
|
||||
}
|
||||
|
||||
public string localizedUndefined { get; set; }
|
||||
public string localizedDefault { get; set; }
|
||||
public string localizedForced { get; set; }
|
||||
|
||||
public string DisplayTitle
|
||||
{
|
||||
get
|
||||
@@ -141,22 +147,30 @@ namespace MediaBrowser.Model.Entities
|
||||
}
|
||||
else
|
||||
{
|
||||
attributes.Add("Und");
|
||||
attributes.Add(string.IsNullOrEmpty(localizedUndefined) ? "Und" : localizedUndefined);
|
||||
}
|
||||
|
||||
if (IsDefault)
|
||||
{
|
||||
attributes.Add("Default");
|
||||
attributes.Add(string.IsNullOrEmpty(localizedDefault) ? "Default" : localizedDefault);
|
||||
}
|
||||
|
||||
if (IsForced)
|
||||
{
|
||||
attributes.Add("Forced");
|
||||
attributes.Add(string.IsNullOrEmpty(localizedForced) ? "Forced" : localizedForced);
|
||||
}
|
||||
|
||||
string name = string.Join(" ", attributes.ToArray());
|
||||
if (!string.IsNullOrEmpty(Title))
|
||||
{
|
||||
return attributes.AsEnumerable()
|
||||
// keep Tags that are not already in Title
|
||||
.Where(tag => Title.IndexOf(tag, StringComparison.OrdinalIgnoreCase) == -1)
|
||||
// attributes concatenation, starting with Title
|
||||
.Aggregate(new StringBuilder(Title), (builder, attr) => builder.Append(" - ").Append(attr))
|
||||
.ToString();
|
||||
}
|
||||
|
||||
return name;
|
||||
return string.Join(" - ", attributes.ToArray());
|
||||
}
|
||||
|
||||
if (Type == MediaStreamType.Video)
|
||||
@@ -220,6 +234,7 @@ namespace MediaBrowser.Model.Entities
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
private string AddLanguageIfNeeded(string title)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Language) &&
|
||||
@@ -241,6 +256,7 @@ namespace MediaBrowser.Model.Entities
|
||||
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
public string NalLengthSize { get; set; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user