1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-10-29 23:22:39 +01:00

Fixed: Optional square and round brackets for "{Release Year}"

This commit is contained in:
Bogdan 2024-10-26 14:32:33 +03:00
parent c946ed83f9
commit 781e0c9d1c
2 changed files with 6 additions and 4 deletions

View File

@ -41,7 +41,7 @@ public class FileNameBuilder : IBuildFileNames
private static readonly Regex TitleRegex = new Regex(@"(?<tag>\{(?:imdb-|edition-))?\{(?<prefix>[- ._\[(]*)(?<token>(?:[a-z0-9]+)(?:(?<separator>[- ._]+)(?:[a-z0-9]+))?)(?::(?<customFormat>[ ,a-z0-9|+-]+(?<![- ])))?(?<suffix>[-} ._)\]]*)\}",
RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
public static readonly Regex ReleaseYearRegex = new Regex(@"\{Release[- ._]Year\}", RegexOptions.Compiled | RegexOptions.IgnoreCase);
public static readonly Regex ReleaseYearRegex = new Regex(@"\{[\[\(]?Release[- ._]Year[\]\)]?\}", RegexOptions.Compiled | RegexOptions.IgnoreCase);
public static readonly Regex MovieTitleRegex = new Regex(@"(?<token>\{(?:Movie)(?<separator>[- ._])(?:Clean)?(?:OriginalTitle|Title(?:The)?)(?::(?<customFormat>[a-z0-9|-]+))?\})",
RegexOptions.Compiled | RegexOptions.IgnoreCase);

View File

@ -20,12 +20,14 @@ public void should_be_able_to_get_by_id()
NamingConfig.Get(config.Id).Id.Should().Be(config.Id);
}
[Test]
public void should_be_able_to_update()
[TestCase("{Movie Title} {Release Year}")]
[TestCase("{Movie Title} {(Release Year)}")]
[TestCase("{Movie Title} {[Release Year]}")]
public void should_be_able_to_update(string standardMovieFormat)
{
var config = NamingConfig.GetSingle();
config.RenameMovies = false;
config.StandardMovieFormat = "{Movie Title} {Release Year}";
config.StandardMovieFormat = standardMovieFormat;
var result = NamingConfig.Put(config);
result.RenameMovies.Should().BeFalse();