mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-17 21:25:39 -04:00
New: Artist Disambiguation Naming Token (#652)
This commit is contained in:
@@ -42,7 +42,9 @@ const artistTokens = [
|
||||
|
||||
{ token: '{Artist NameThe}', example: 'Artist Name, The' },
|
||||
|
||||
{ token: '{Artist CleanName}', example: 'Artist Name' }
|
||||
{ token: '{Artist CleanName}', example: 'Artist Name' },
|
||||
|
||||
{ token: '{Artist Disambiguation}', example: 'Disambiguation' }
|
||||
];
|
||||
|
||||
const albumTokens = [
|
||||
|
||||
@@ -29,6 +29,10 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
||||
_artist = Builder<Artist>
|
||||
.CreateNew()
|
||||
.With(s => s.Name = "Linkin Park")
|
||||
.With(s => s.Metadata = new ArtistMetadata {
|
||||
Disambiguation = "US Rock Band",
|
||||
Name = "Linkin Park"
|
||||
})
|
||||
.Build();
|
||||
|
||||
_album = Builder<Album>
|
||||
@@ -147,6 +151,15 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
||||
.Should().Be("Linkin.Park.1997");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_replace_Artist_Disambiguation()
|
||||
{
|
||||
_namingConfig.StandardTrackFormat = "{Artist Disambiguation}";
|
||||
|
||||
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
||||
.Should().Be("US Rock Band");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_replace_Album_space_Title()
|
||||
{
|
||||
|
||||
@@ -265,6 +265,11 @@ namespace NzbDrone.Core.Organizer
|
||||
tokenHandlers["{Artist Name}"] = m => artist.Name;
|
||||
tokenHandlers["{Artist CleanName}"] = m => CleanTitle(artist.Name);
|
||||
tokenHandlers["{Artist NameThe}"] = m => TitleThe(artist.Name);
|
||||
|
||||
if (artist.Metadata.Value.Disambiguation != null)
|
||||
{
|
||||
tokenHandlers["{Artist Disambiguation}"] = m => artist.Metadata.Value.Disambiguation;
|
||||
}
|
||||
}
|
||||
|
||||
private void AddAlbumTokens(Dictionary<string, Func<TokenMatch, string>> tokenHandlers, Album album)
|
||||
|
||||
@@ -33,7 +33,9 @@ namespace NzbDrone.Core.Organizer
|
||||
{
|
||||
Metadata = new ArtistMetadata
|
||||
{
|
||||
Name = "The Artist Name"
|
||||
Name = "The Artist Name",
|
||||
Disambiguation = "US Rock Band"
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user