Fixed: MediaInfo tag in renaming format for certain OS language cultures
Based-On: a0d2af54e8
This commit is contained in:
parent
bcdbadbede
commit
87897d56ea
|
@ -1,6 +1,8 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
|
@ -812,6 +814,32 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
|||
.Should().Be(releaseGroup);
|
||||
}
|
||||
|
||||
[TestCase("en-US")]
|
||||
[TestCase("fr-FR")]
|
||||
[TestCase("az")]
|
||||
[TestCase("tr-TR")]
|
||||
public void should_replace_all_tokens_for_different_cultures(string culture)
|
||||
{
|
||||
var oldCulture = Thread.CurrentThread.CurrentCulture;
|
||||
try
|
||||
{
|
||||
Thread.CurrentThread.CurrentCulture = new CultureInfo(culture);
|
||||
|
||||
_episodeFile.ReleaseGroup = null;
|
||||
|
||||
GivenMediaInfoModel(audioLanguages: "English/German");
|
||||
|
||||
_namingConfig.StandardEpisodeFormat = "{MediaInfo AudioLanguages}";
|
||||
|
||||
Subject.BuildFileName(new List<Episode> { _episode1 }, _series, _episodeFile)
|
||||
.Should().Be("[EN+DE]");
|
||||
}
|
||||
finally
|
||||
{
|
||||
Thread.CurrentThread.CurrentCulture = oldCulture;
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase("English", "")]
|
||||
[TestCase("English/German", "[EN+DE]")]
|
||||
public void should_format_audio_languages(string audioLanguages, string expected)
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace NzbDrone.Core.Organizer
|
|||
private readonly Logger _logger;
|
||||
|
||||
private static readonly Regex TitleRegex = new Regex(@"(?<escaped>\{\{|\}\})|\{(?<prefix>[- ._\[(]*)(?<token>(?:[a-z0-9]+)(?:(?<separator>[- ._]+)(?:[a-z0-9]+))?)(?::(?<customFormat>[a-z0-9+-]+(?<!-)))?(?<suffix>[- ._)\]]*)\}",
|
||||
RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||
|
||||
private static readonly Regex EpisodeRegex = new Regex(@"(?<episode>\{episode(?:\:0+)?})",
|
||||
RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
|
Loading…
Reference in New Issue