New: Artist Disambiguation Naming Token (#652)

This commit is contained in:
Qstick 2019-03-06 21:07:21 -05:00 committed by GitHub
parent 21f1fd17bb
commit 3292fba66c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 2 deletions

View File

@ -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 = [

View File

@ -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()
{

View File

@ -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)

View File

@ -33,7 +33,9 @@ namespace NzbDrone.Core.Organizer
{
Metadata = new ArtistMetadata
{
Name = "The Artist Name"
Name = "The Artist Name",
Disambiguation = "US Rock Band"
}
};