This commit is contained in:
gaizaharduz 2025-06-17 11:31:04 +10:00 committed by GitHub
commit ec3cbc550f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 9 deletions

View file

@ -29,11 +29,11 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
{ {
_artist = Builder<Artist> _artist = Builder<Artist>
.CreateNew() .CreateNew()
.With(s => s.Name = "Linkin Park") .With(s => s.Name = "Metallica")
.With(s => s.Metadata = new ArtistMetadata .With(s => s.Metadata = new ArtistMetadata
{ {
Disambiguation = "US Rock Band", Disambiguation = "US Metal Band",
Name = "Linkin Park" Name = "Metallica"
}) })
.Build(); .Build();
@ -57,7 +57,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
_album = Builder<Album> _album = Builder<Album>
.CreateNew() .CreateNew()
.With(s => s.Title = "Hybrid Theory") .With(s => s.Title = "...And Justice For All")
.With(s => s.ReleaseDate = new DateTime(2020, 1, 15)) .With(s => s.ReleaseDate = new DateTime(2020, 1, 15))
.With(s => s.AlbumType = "Album") .With(s => s.AlbumType = "Album")
.With(s => s.Disambiguation = "The Best Album") .With(s => s.Disambiguation = "The Best Album")
@ -99,7 +99,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
_namingConfig.StandardTrackFormat = "{Album Title} {(Release Year)}/{Artist Name} - {track:00} [{Quality Title}] {[Quality Proper]}"; _namingConfig.StandardTrackFormat = "{Album Title} {(Release Year)}/{Artist Name} - {track:00} [{Quality Title}] {[Quality Proper]}";
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile) Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
.Should().Be("Hybrid Theory (2020)\\Linkin Park - 06 [MP3-256]".AsOsAgnostic()); .Should().Be("And Justice For All (2020)\\Metallica - 06 [MP3-256]".AsOsAgnostic());
} }
[Test] [Test]
@ -108,7 +108,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
_namingConfig.StandardTrackFormat = "{Album Title} {(Release Year)}\\{Artist Name} - {track:00} [{Quality Title}] {[Quality Proper]}"; _namingConfig.StandardTrackFormat = "{Album Title} {(Release Year)}\\{Artist Name} - {track:00} [{Quality Title}] {[Quality Proper]}";
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile) Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
.Should().Be("Hybrid Theory (2020)\\Linkin Park - 06 [MP3-256]".AsOsAgnostic()); .Should().Be("And Justice For All (2020)\\Metallica - 06 [MP3-256]".AsOsAgnostic());
} }
[Test] [Test]
@ -119,7 +119,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
_release.Media.Add(_medium2); _release.Media.Add(_medium2);
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile) Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
.Should().Be("Hybrid Theory (2020)\\CD 03\\Linkin Park - 06 [MP3-256]".AsOsAgnostic()); .Should().Be("And Justice For All (2020)\\CD 03\\Metallica - 06 [MP3-256]".AsOsAgnostic());
} }
[Test] [Test]
@ -130,7 +130,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
_release.Media.Add(_medium2); _release.Media.Add(_medium2);
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile) Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
.Should().Be("Hybrid Theory (2020)\\CD 03\\Linkin Park - 06 [MP3-256]".AsOsAgnostic()); .Should().Be("And Justice For All (2020)\\CD 03\\Metallica - 06 [MP3-256]".AsOsAgnostic());
} }
[Test] [Test]

View file

@ -144,7 +144,7 @@ namespace NzbDrone.Core.Organizer
AddTrackTitleTokens(tokenHandlers, tracks, maxTrackTitleLength); AddTrackTitleTokens(tokenHandlers, tracks, maxTrackTitleLength);
component = ReplaceTokens(component, tokenHandlers, namingConfig).Trim(); component = ReplaceTokens(component, tokenHandlers, namingConfig).Trim();
component = FileNameCleanupRegex.Replace(component, match => match.Captures[0].Value[0].ToString()); component = CleanFolderName(component);
component = TrimSeparatorsRegex.Replace(component, string.Empty); component = TrimSeparatorsRegex.Replace(component, string.Empty);
component = component.Replace("{ellipsis}", "..."); component = component.Replace("{ellipsis}", "...");
component = ReplaceReservedDeviceNames(component); component = ReplaceReservedDeviceNames(component);