mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
Fixed some mediainfo subtitle codes
Co-Authored-By: Mark McDowall <markus101@users.noreply.github.com>
This commit is contained in:
parent
0086e2699e
commit
6ee2780370
@ -364,7 +364,7 @@ public void should_format_mediainfo_properly()
|
|||||||
{
|
{
|
||||||
_namingConfig.StandardMovieFormat = "{Movie.Title}.{MEDIAINFO.FULL}";
|
_namingConfig.StandardMovieFormat = "{Movie.Title}.{MEDIAINFO.FULL}";
|
||||||
|
|
||||||
_movieFile.MediaInfo = new Core.MediaFiles.MediaInfo.MediaInfoModel()
|
_movieFile.MediaInfo = new MediaInfoModel()
|
||||||
{
|
{
|
||||||
VideoFormat = "AVC",
|
VideoFormat = "AVC",
|
||||||
AudioFormat = "DTS",
|
AudioFormat = "DTS",
|
||||||
@ -376,12 +376,33 @@ public void should_format_mediainfo_properly()
|
|||||||
.Should().Be("South.Park.H264.DTS[EN+ES].[EN+ES+IT]");
|
.Should().Be("South.Park.H264.DTS[EN+ES].[EN+ES+IT]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestCase("Norwegian Bokmal", "NB")]
|
||||||
|
[TestCase("Swedis", "SV")]
|
||||||
|
[TestCase("Chinese", "ZH")]
|
||||||
|
public void should_format_languagecodes_properly(string language, string code)
|
||||||
|
{
|
||||||
|
_namingConfig.StandardMovieFormat = "{Movie.Title}.{MEDIAINFO.FULL}";
|
||||||
|
|
||||||
|
_movieFile.MediaInfo = new MediaInfoModel()
|
||||||
|
{
|
||||||
|
VideoCodec = "AVC",
|
||||||
|
AudioFormat = "DTS",
|
||||||
|
AudioChannels = 6,
|
||||||
|
AudioLanguages = "English",
|
||||||
|
Subtitles = language,
|
||||||
|
SchemaRevision = 3
|
||||||
|
};
|
||||||
|
|
||||||
|
Subject.BuildFileName(_movie, _movieFile)
|
||||||
|
.Should().Be($"South.Park.X264.DTS.[{code}]");
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_exclude_english_in_mediainfo_audio_language()
|
public void should_exclude_english_in_mediainfo_audio_language()
|
||||||
{
|
{
|
||||||
_namingConfig.StandardMovieFormat = "{Movie.Title}.{MEDIAINFO.FULL}";
|
_namingConfig.StandardMovieFormat = "{Movie.Title}.{MEDIAINFO.FULL}";
|
||||||
|
|
||||||
_movieFile.MediaInfo = new Core.MediaFiles.MediaInfo.MediaInfoModel()
|
_movieFile.MediaInfo = new MediaInfoModel()
|
||||||
{
|
{
|
||||||
VideoFormat = "AVC",
|
VideoFormat = "AVC",
|
||||||
AudioFormat = "DTS",
|
AudioFormat = "DTS",
|
||||||
@ -398,7 +419,7 @@ public void should_format_mediainfo_3d_properly()
|
|||||||
{
|
{
|
||||||
_namingConfig.StandardMovieFormat = "{Movie.Title}.{MEDIAINFO.3D}.{MediaInfo.Simple}";
|
_namingConfig.StandardMovieFormat = "{Movie.Title}.{MEDIAINFO.3D}.{MediaInfo.Simple}";
|
||||||
|
|
||||||
_movieFile.MediaInfo = new Core.MediaFiles.MediaInfo.MediaInfoModel()
|
_movieFile.MediaInfo = new MediaInfoModel()
|
||||||
{
|
{
|
||||||
VideoFormat = "AVC",
|
VideoFormat = "AVC",
|
||||||
VideoMultiViewCount = 2,
|
VideoMultiViewCount = 2,
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common.EnsureThat;
|
using NzbDrone.Common.EnsureThat;
|
||||||
|
using NzbDrone.Common.EnvironmentInfo;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Core.CustomFormats;
|
using NzbDrone.Core.CustomFormats;
|
||||||
using NzbDrone.Core.MediaFiles;
|
using NzbDrone.Core.MediaFiles;
|
||||||
@ -414,9 +415,23 @@ private string GetLanguagesToken(string mediaInfoLanguages)
|
|||||||
var cultures = CultureInfo.GetCultures(CultureTypes.NeutralCultures);
|
var cultures = CultureInfo.GetCultures(CultureTypes.NeutralCultures);
|
||||||
for (int i = 0; i < tokens.Count; i++)
|
for (int i = 0; i < tokens.Count; i++)
|
||||||
{
|
{
|
||||||
|
if (tokens[i] == "Swedis")
|
||||||
|
{
|
||||||
|
// Probably typo in mediainfo (should be 'Swedish')
|
||||||
|
tokens[i] = "SV";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tokens[i] == "Chinese" && OsInfo.IsNotWindows)
|
||||||
|
{
|
||||||
|
// Mono only has 'Chinese (Simplified)' & 'Chinese (Traditional)'
|
||||||
|
tokens[i] = "ZH";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var cultureInfo = cultures.FirstOrDefault(p => p.EnglishName == tokens[i]);
|
var cultureInfo = cultures.FirstOrDefault(p => p.EnglishName.RemoveAccent() == tokens[i]);
|
||||||
|
|
||||||
if (cultureInfo != null)
|
if (cultureInfo != null)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user