mirror of https://github.com/lidarr/Lidarr
Fixed: Release Year in renaming format for certain OS language cultures
Based-On: a0d2af54e8
(cherry picked from commit 87897d56ea62544a36986eb09d420649668d7400)
This commit is contained in:
parent
c3eda6ff12
commit
24b8029d2e
|
@ -1,7 +1,9 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
|
@ -793,6 +795,30 @@ 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);
|
||||
|
||||
_album.ReleaseDate = new DateTime(2021, 1, 15);
|
||||
|
||||
_namingConfig.StandardTrackFormat = "{Release Year}";
|
||||
|
||||
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
||||
.Should().Be("2021");
|
||||
}
|
||||
finally
|
||||
{
|
||||
Thread.CurrentThread.CurrentCulture = oldCulture;
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_replace_artist_name_for_Various_Artists_album()
|
||||
{
|
||||
|
|
|
@ -35,7 +35,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);
|
||||
|
||||
public static readonly Regex TrackRegex = new Regex(@"(?<track>\{track(?:\:0+)?})",
|
||||
RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
|
Loading…
Reference in New Issue