Add label for external audio/sub tracks
This commit is contained in:
parent
388e0cba9f
commit
1a307db7eb
|
@ -5970,6 +5970,7 @@ AND Type = @InternalPersonType)");
|
||||||
item.LocalizedUndefined = _localization.GetLocalizedString("Undefined");
|
item.LocalizedUndefined = _localization.GetLocalizedString("Undefined");
|
||||||
item.LocalizedDefault = _localization.GetLocalizedString("Default");
|
item.LocalizedDefault = _localization.GetLocalizedString("Default");
|
||||||
item.LocalizedForced = _localization.GetLocalizedString("Forced");
|
item.LocalizedForced = _localization.GetLocalizedString("Forced");
|
||||||
|
item.LocalizedExternal = _localization.GetLocalizedString("External");
|
||||||
}
|
}
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
"Default": "Default",
|
"Default": "Default",
|
||||||
"DeviceOfflineWithName": "{0} has disconnected",
|
"DeviceOfflineWithName": "{0} has disconnected",
|
||||||
"DeviceOnlineWithName": "{0} is connected",
|
"DeviceOnlineWithName": "{0} is connected",
|
||||||
|
"External": "External",
|
||||||
"FailedLoginAttemptWithUserName": "Failed login try from {0}",
|
"FailedLoginAttemptWithUserName": "Failed login try from {0}",
|
||||||
"Favorites": "Favorites",
|
"Favorites": "Favorites",
|
||||||
"Folders": "Folders",
|
"Folders": "Folders",
|
||||||
|
|
|
@ -706,6 +706,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||||
stream.LocalizedUndefined = _localization.GetLocalizedString("Undefined");
|
stream.LocalizedUndefined = _localization.GetLocalizedString("Undefined");
|
||||||
stream.LocalizedDefault = _localization.GetLocalizedString("Default");
|
stream.LocalizedDefault = _localization.GetLocalizedString("Default");
|
||||||
stream.LocalizedForced = _localization.GetLocalizedString("Forced");
|
stream.LocalizedForced = _localization.GetLocalizedString("Forced");
|
||||||
|
stream.LocalizedExternal = _localization.GetLocalizedString("External");
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(stream.Title))
|
if (string.IsNullOrEmpty(stream.Title))
|
||||||
{
|
{
|
||||||
|
|
|
@ -140,6 +140,8 @@ namespace MediaBrowser.Model.Entities
|
||||||
|
|
||||||
public string LocalizedForced { get; set; }
|
public string LocalizedForced { get; set; }
|
||||||
|
|
||||||
|
public string LocalizedExternal { get; set; }
|
||||||
|
|
||||||
public string DisplayTitle
|
public string DisplayTitle
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -184,6 +186,11 @@ namespace MediaBrowser.Model.Entities
|
||||||
attributes.Add(string.IsNullOrEmpty(LocalizedDefault) ? "Default" : LocalizedDefault);
|
attributes.Add(string.IsNullOrEmpty(LocalizedDefault) ? "Default" : LocalizedDefault);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsExternal)
|
||||||
|
{
|
||||||
|
attributes.Add(string.IsNullOrEmpty(LocalizedExternal) ? "External" : LocalizedExternal);
|
||||||
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Title))
|
if (!string.IsNullOrEmpty(Title))
|
||||||
{
|
{
|
||||||
var result = new StringBuilder(Title);
|
var result = new StringBuilder(Title);
|
||||||
|
@ -274,6 +281,11 @@ namespace MediaBrowser.Model.Entities
|
||||||
attributes.Add(Codec.ToUpperInvariant());
|
attributes.Add(Codec.ToUpperInvariant());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsExternal)
|
||||||
|
{
|
||||||
|
attributes.Add(string.IsNullOrEmpty(LocalizedExternal) ? "External" : LocalizedExternal);
|
||||||
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Title))
|
if (!string.IsNullOrEmpty(Title))
|
||||||
{
|
{
|
||||||
var result = new StringBuilder(Title);
|
var result = new StringBuilder(Title);
|
||||||
|
|
|
@ -5,11 +5,12 @@ namespace Jellyfin.Model.Tests.Entities
|
||||||
{
|
{
|
||||||
public class MediaStreamTests
|
public class MediaStreamTests
|
||||||
{
|
{
|
||||||
public static TheoryData<MediaStream, string> Get_DisplayTitle_TestData()
|
public static TheoryData<string, MediaStream> Get_DisplayTitle_TestData()
|
||||||
{
|
{
|
||||||
var data = new TheoryData<MediaStream, string>();
|
var data = new TheoryData<string, MediaStream>();
|
||||||
|
|
||||||
data.Add(
|
data.Add(
|
||||||
|
"English - Und - ASS",
|
||||||
new MediaStream
|
new MediaStream
|
||||||
{
|
{
|
||||||
Type = MediaStreamType.Subtitle,
|
Type = MediaStreamType.Subtitle,
|
||||||
|
@ -18,10 +19,10 @@ namespace Jellyfin.Model.Tests.Entities
|
||||||
IsForced = false,
|
IsForced = false,
|
||||||
IsDefault = false,
|
IsDefault = false,
|
||||||
Codec = "ASS"
|
Codec = "ASS"
|
||||||
},
|
});
|
||||||
"English - Und - ASS");
|
|
||||||
|
|
||||||
data.Add(
|
data.Add(
|
||||||
|
"English - Und",
|
||||||
new MediaStream
|
new MediaStream
|
||||||
{
|
{
|
||||||
Type = MediaStreamType.Subtitle,
|
Type = MediaStreamType.Subtitle,
|
||||||
|
@ -30,10 +31,10 @@ namespace Jellyfin.Model.Tests.Entities
|
||||||
IsForced = false,
|
IsForced = false,
|
||||||
IsDefault = false,
|
IsDefault = false,
|
||||||
Codec = string.Empty
|
Codec = string.Empty
|
||||||
},
|
});
|
||||||
"English - Und");
|
|
||||||
|
|
||||||
data.Add(
|
data.Add(
|
||||||
|
"English",
|
||||||
new MediaStream
|
new MediaStream
|
||||||
{
|
{
|
||||||
Type = MediaStreamType.Subtitle,
|
Type = MediaStreamType.Subtitle,
|
||||||
|
@ -42,10 +43,10 @@ namespace Jellyfin.Model.Tests.Entities
|
||||||
IsForced = false,
|
IsForced = false,
|
||||||
IsDefault = false,
|
IsDefault = false,
|
||||||
Codec = string.Empty
|
Codec = string.Empty
|
||||||
},
|
});
|
||||||
"English");
|
|
||||||
|
|
||||||
data.Add(
|
data.Add(
|
||||||
|
"English - Default - Forced - SRT",
|
||||||
new MediaStream
|
new MediaStream
|
||||||
{
|
{
|
||||||
Type = MediaStreamType.Subtitle,
|
Type = MediaStreamType.Subtitle,
|
||||||
|
@ -54,10 +55,23 @@ namespace Jellyfin.Model.Tests.Entities
|
||||||
IsForced = true,
|
IsForced = true,
|
||||||
IsDefault = true,
|
IsDefault = true,
|
||||||
Codec = "SRT"
|
Codec = "SRT"
|
||||||
},
|
});
|
||||||
"English - Default - Forced - SRT");
|
|
||||||
|
|
||||||
data.Add(
|
data.Add(
|
||||||
|
"Title - EN - Default - Forced - SRT - External",
|
||||||
|
new MediaStream
|
||||||
|
{
|
||||||
|
Type = MediaStreamType.Subtitle,
|
||||||
|
Title = "Title",
|
||||||
|
Language = "EN",
|
||||||
|
IsForced = true,
|
||||||
|
IsDefault = true,
|
||||||
|
Codec = "SRT",
|
||||||
|
IsExternal = true
|
||||||
|
});
|
||||||
|
|
||||||
|
data.Add(
|
||||||
|
"Und",
|
||||||
new MediaStream
|
new MediaStream
|
||||||
{
|
{
|
||||||
Type = MediaStreamType.Subtitle,
|
Type = MediaStreamType.Subtitle,
|
||||||
|
@ -66,15 +80,27 @@ namespace Jellyfin.Model.Tests.Entities
|
||||||
IsForced = false,
|
IsForced = false,
|
||||||
IsDefault = false,
|
IsDefault = false,
|
||||||
Codec = null
|
Codec = null
|
||||||
},
|
});
|
||||||
"Und");
|
|
||||||
|
data.Add(
|
||||||
|
"Title - AAC - Default - External",
|
||||||
|
new MediaStream
|
||||||
|
{
|
||||||
|
Type = MediaStreamType.Audio,
|
||||||
|
Title = "Title",
|
||||||
|
Language = null,
|
||||||
|
IsForced = false,
|
||||||
|
IsDefault = true,
|
||||||
|
Codec = "AAC",
|
||||||
|
IsExternal = true
|
||||||
|
});
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[MemberData(nameof(Get_DisplayTitle_TestData))]
|
[MemberData(nameof(Get_DisplayTitle_TestData))]
|
||||||
public void Get_DisplayTitle_should_return_valid_title(MediaStream mediaStream, string expected)
|
public void Get_DisplayTitle_should_return_valid_title(string expected, MediaStream mediaStream)
|
||||||
{
|
{
|
||||||
Assert.Equal(expected, mediaStream.DisplayTitle);
|
Assert.Equal(expected, mediaStream.DisplayTitle);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user