Fixed: Allow more prefixes and suffixes for Release Year naming token

This commit is contained in:
Bogdan 2025-06-04 18:48:19 +03:00
parent 73b99d0be2
commit d28f03af28
2 changed files with 6 additions and 1 deletions

View file

@ -41,7 +41,7 @@ public class FileNameBuilder : IBuildFileNames
private static readonly Regex TitleRegex = new Regex(@"(?<tag>\{(?<prefix>[-{ ._\[(]*)(?:imdb(?:id)?-|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

@ -23,6 +23,11 @@ public void should_be_able_to_get_by_id()
[TestCase("{Movie Title} {Release Year}")]
[TestCase("{Movie Title} {(Release Year)}")]
[TestCase("{Movie Title} {[Release Year]}")]
[TestCase("{Movie Title} {{Release Year}}")]
[TestCase("{Movie Title}{ Release Year }")]
[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();