mirror of
https://github.com/Radarr/Radarr.git
synced 2024-08-18 16:29:41 +02:00
Fixed: Naming Token Regex can fail on certain Cultures (#5855)
[common]
This commit is contained in:
parent
ad3ddd11cf
commit
a0d2af54e8
@ -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;
|
||||
@ -564,6 +566,24 @@ public void should_be_able_to_use_original_filename()
|
||||
.Should().Be("30 Rock - 30 Rock - S01E01 - Test");
|
||||
}
|
||||
|
||||
[TestCase("en-US")]
|
||||
[TestCase("fr-FR")]
|
||||
[TestCase("az")]
|
||||
[TestCase("tr-TR")]
|
||||
public void should_replace_all_tokens_for_different_cultures(string culture)
|
||||
{
|
||||
Thread.CurrentThread.CurrentCulture = new CultureInfo(culture);
|
||||
|
||||
_movie.TmdbId = 124578;
|
||||
_movie.Year = 2020;
|
||||
GivenMediaInfoModel();
|
||||
|
||||
_namingConfig.StandardMovieFormat = "{Movie CleanTitle} ({Release Year}) [{Quality Title}] [tmdb-{TmdbId}] [{MediaInfo AudioCodec}]";
|
||||
|
||||
Subject.BuildFileName(_movie, _movieFile)
|
||||
.Should().Be("South Park (2020) [HDTV-720p] [tmdb-124578] [DTS]");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_be_able_to_use_original_filename_only()
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ public class FileNameBuilder : IBuildFileNames
|
||||
private readonly Logger _logger;
|
||||
|
||||
private static readonly Regex TitleRegex = new Regex(@"\{(?<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 TagsRegex = new Regex(@"(?<tags>\{tags(?:\:0+)?})",
|
||||
RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
Loading…
Reference in New Issue
Block a user