mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-19 13:10:13 -07:00
New: Artist Disambiguation Naming Token (#652)
This commit is contained in:
parent
21f1fd17bb
commit
3292fba66c
4 changed files with 24 additions and 2 deletions
|
@ -42,7 +42,9 @@ const artistTokens = [
|
||||||
|
|
||||||
{ token: '{Artist NameThe}', example: 'Artist Name, The' },
|
{ 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 = [
|
const albumTokens = [
|
||||||
|
|
|
@ -29,6 +29,10 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
||||||
_artist = Builder<Artist>
|
_artist = Builder<Artist>
|
||||||
.CreateNew()
|
.CreateNew()
|
||||||
.With(s => s.Name = "Linkin Park")
|
.With(s => s.Name = "Linkin Park")
|
||||||
|
.With(s => s.Metadata = new ArtistMetadata {
|
||||||
|
Disambiguation = "US Rock Band",
|
||||||
|
Name = "Linkin Park"
|
||||||
|
})
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
_album = Builder<Album>
|
_album = Builder<Album>
|
||||||
|
@ -147,6 +151,15 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
||||||
.Should().Be("Linkin.Park.1997");
|
.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]
|
[Test]
|
||||||
public void should_replace_Album_space_Title()
|
public void should_replace_Album_space_Title()
|
||||||
{
|
{
|
||||||
|
|
|
@ -265,6 +265,11 @@ namespace NzbDrone.Core.Organizer
|
||||||
tokenHandlers["{Artist Name}"] = m => artist.Name;
|
tokenHandlers["{Artist Name}"] = m => artist.Name;
|
||||||
tokenHandlers["{Artist CleanName}"] = m => CleanTitle(artist.Name);
|
tokenHandlers["{Artist CleanName}"] = m => CleanTitle(artist.Name);
|
||||||
tokenHandlers["{Artist NameThe}"] = m => TitleThe(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)
|
private void AddAlbumTokens(Dictionary<string, Func<TokenMatch, string>> tokenHandlers, Album album)
|
||||||
|
|
|
@ -33,7 +33,9 @@ namespace NzbDrone.Core.Organizer
|
||||||
{
|
{
|
||||||
Metadata = new ArtistMetadata
|
Metadata = new ArtistMetadata
|
||||||
{
|
{
|
||||||
Name = "The Artist Name"
|
Name = "The Artist Name",
|
||||||
|
Disambiguation = "US Rock Band"
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue