diff options
| author | Cody Robibero <cody@robibe.ro> | 2022-03-11 07:48:23 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-11 07:48:23 -0700 |
| commit | 28223704f3c1c38c5a4acc65b38e2e8a1a06ea3d (patch) | |
| tree | 41b4e106e4b74ef6a3b65742cef551c3e0ef7183 | |
| parent | 3342c29f4f4f0fa64da319090fa6f42baeba9df0 (diff) | |
| parent | f671eeb6b271c5c2e153181ab29a3a4ab0195bff (diff) | |
Merge pull request #7441 from 1337joe/add-external-stream-indicator
Add label for external audio/sub tracks
| -rw-r--r-- | CONTRIBUTORS.md | 1 | ||||
| -rw-r--r-- | Emby.Server.Implementations/Data/SqliteItemRepository.cs | 1 | ||||
| -rw-r--r-- | Emby.Server.Implementations/Localization/Core/en-US.json | 1 | ||||
| -rw-r--r-- | MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs | 1 | ||||
| -rw-r--r-- | MediaBrowser.Model/Entities/MediaStream.cs | 12 | ||||
| -rw-r--r-- | tests/Jellyfin.Model.Tests/Entities/MediaStreamTests.cs | 68 |
6 files changed, 63 insertions, 21 deletions
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index f23ecf942..c7b33d1c3 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -1,5 +1,6 @@ # Jellyfin Contributors + - [1337joe](https://github.com/1337joe) - [97carmine](https://github.com/97carmine) - [Abbe98](https://github.com/Abbe98) - [agrenott](https://github.com/agrenott) diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs index b3b383bfd..85fa79cba 100644 --- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs @@ -5970,6 +5970,7 @@ AND Type = @InternalPersonType)"); item.LocalizedUndefined = _localization.GetLocalizedString("Undefined"); item.LocalizedDefault = _localization.GetLocalizedString("Default"); item.LocalizedForced = _localization.GetLocalizedString("Forced"); + item.LocalizedExternal = _localization.GetLocalizedString("External"); } return item; diff --git a/Emby.Server.Implementations/Localization/Core/en-US.json b/Emby.Server.Implementations/Localization/Core/en-US.json index e06f8e6fe..d8c33d51b 100644 --- a/Emby.Server.Implementations/Localization/Core/en-US.json +++ b/Emby.Server.Implementations/Localization/Core/en-US.json @@ -12,6 +12,7 @@ "Default": "Default", "DeviceOfflineWithName": "{0} has disconnected", "DeviceOnlineWithName": "{0} is connected", + "External": "External", "FailedLoginAttemptWithUserName": "Failed login try from {0}", "Favorites": "Favorites", "Folders": "Folders", diff --git a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs index 8c0abe10d..3f78d0d42 100644 --- a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs +++ b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs @@ -717,6 +717,7 @@ namespace MediaBrowser.MediaEncoding.Probing stream.LocalizedUndefined = _localization.GetLocalizedString("Undefined"); stream.LocalizedDefault = _localization.GetLocalizedString("Default"); stream.LocalizedForced = _localization.GetLocalizedString("Forced"); + stream.LocalizedExternal = _localization.GetLocalizedString("External"); if (string.IsNullOrEmpty(stream.Title)) { diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs index e2616d92a..4742d21e9 100644 --- a/MediaBrowser.Model/Entities/MediaStream.cs +++ b/MediaBrowser.Model/Entities/MediaStream.cs @@ -140,6 +140,8 @@ namespace MediaBrowser.Model.Entities public string LocalizedForced { get; set; } + public string LocalizedExternal { get; set; } + public string DisplayTitle { get @@ -184,6 +186,11 @@ namespace MediaBrowser.Model.Entities attributes.Add(string.IsNullOrEmpty(LocalizedDefault) ? "Default" : LocalizedDefault); } + if (IsExternal) + { + attributes.Add(string.IsNullOrEmpty(LocalizedExternal) ? "External" : LocalizedExternal); + } + if (!string.IsNullOrEmpty(Title)) { var result = new StringBuilder(Title); @@ -274,6 +281,11 @@ namespace MediaBrowser.Model.Entities attributes.Add(Codec.ToUpperInvariant()); } + if (IsExternal) + { + attributes.Add(string.IsNullOrEmpty(LocalizedExternal) ? "External" : LocalizedExternal); + } + if (!string.IsNullOrEmpty(Title)) { var result = new StringBuilder(Title); diff --git a/tests/Jellyfin.Model.Tests/Entities/MediaStreamTests.cs b/tests/Jellyfin.Model.Tests/Entities/MediaStreamTests.cs index 0c97a90b4..9fcf8189f 100644 --- a/tests/Jellyfin.Model.Tests/Entities/MediaStreamTests.cs +++ b/tests/Jellyfin.Model.Tests/Entities/MediaStreamTests.cs @@ -5,23 +5,24 @@ namespace Jellyfin.Model.Tests.Entities { 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( - new MediaStream - { - Type = MediaStreamType.Subtitle, - Title = "English", - Language = string.Empty, - IsForced = false, - IsDefault = false, - Codec = "ASS" - }, - "English - Und - ASS"); + "English - Und - ASS", + new MediaStream + { + Type = MediaStreamType.Subtitle, + Title = "English", + Language = string.Empty, + IsForced = false, + IsDefault = false, + Codec = "ASS" + }); data.Add( + "English - Und", new MediaStream { Type = MediaStreamType.Subtitle, @@ -30,10 +31,10 @@ namespace Jellyfin.Model.Tests.Entities IsForced = false, IsDefault = false, Codec = string.Empty - }, - "English - Und"); + }); data.Add( + "English", new MediaStream { Type = MediaStreamType.Subtitle, @@ -42,10 +43,10 @@ namespace Jellyfin.Model.Tests.Entities IsForced = false, IsDefault = false, Codec = string.Empty - }, - "English"); + }); data.Add( + "English - Default - Forced - SRT", new MediaStream { Type = MediaStreamType.Subtitle, @@ -54,10 +55,23 @@ namespace Jellyfin.Model.Tests.Entities IsForced = true, IsDefault = true, Codec = "SRT" - }, - "English - Default - Forced - SRT"); + }); + + 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 { Type = MediaStreamType.Subtitle, @@ -66,15 +80,27 @@ namespace Jellyfin.Model.Tests.Entities IsForced = false, IsDefault = false, 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; } [Theory] [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); } |
