mirror of https://github.com/lidarr/Lidarr
New: Album and Artist Genre Naming Tokens
This commit is contained in:
parent
f7548f9bb7
commit
ec41951ea5
|
@ -47,7 +47,9 @@ const artistTokens = [
|
|||
|
||||
{ token: '{Artist CleanName}', example: 'Artist Name' },
|
||||
|
||||
{ token: '{Artist Disambiguation}', example: 'Disambiguation' }
|
||||
{ token: '{Artist Disambiguation}', example: 'Disambiguation' },
|
||||
|
||||
{ token: '{Artist Genre}', example: 'Pop' }
|
||||
];
|
||||
|
||||
const albumTokens = [
|
||||
|
@ -59,7 +61,9 @@ const albumTokens = [
|
|||
|
||||
{ token: '{Album Type}', example: 'Album Type' },
|
||||
|
||||
{ token: '{Album Disambiguation}', example: 'Disambiguation' }
|
||||
{ token: '{Album Disambiguation}', example: 'Disambiguation' },
|
||||
|
||||
{ token: '{Album Genre}', example: 'Rock' }
|
||||
];
|
||||
|
||||
const mediumTokens = [
|
||||
|
|
|
@ -10,6 +10,7 @@ using NzbDrone.Core.Music;
|
|||
using NzbDrone.Core.Organizer;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using TagLib;
|
||||
|
||||
namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
||||
{
|
||||
|
@ -37,7 +38,8 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
|||
.With(s => s.Metadata = new ArtistMetadata
|
||||
{
|
||||
Disambiguation = "US Rock Band",
|
||||
Name = "Linkin Park"
|
||||
Name = "Linkin Park",
|
||||
Genres = new List<string> { "Rock" }
|
||||
})
|
||||
.Build();
|
||||
|
||||
|
@ -66,6 +68,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
|||
.With(s => s.Title = "Hybrid Theory")
|
||||
.With(s => s.AlbumType = "Album")
|
||||
.With(s => s.Disambiguation = "The Best Album")
|
||||
.With(s => s.Genres = new List<string> { "Rock" })
|
||||
.Build();
|
||||
|
||||
_mixAlbum = Builder<Album>
|
||||
|
@ -205,6 +208,15 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
|||
.Should().Be("US Rock Band");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_replace_artist_genre()
|
||||
{
|
||||
_namingConfig.StandardTrackFormat = "{Artist Genre}";
|
||||
|
||||
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
||||
.Should().Be("Rock");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_replace_Album_space_Title()
|
||||
{
|
||||
|
@ -232,6 +244,15 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
|||
.Should().Be("The Best Album");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_replace_album_genre()
|
||||
{
|
||||
_namingConfig.StandardTrackFormat = "{Album Genre}";
|
||||
|
||||
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
||||
.Should().Be("Rock");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_replace_Album_underscore_Title()
|
||||
{
|
||||
|
|
|
@ -267,6 +267,7 @@ namespace NzbDrone.Core.Organizer
|
|||
tokenHandlers["{Artist Name}"] = m => artist.Name;
|
||||
tokenHandlers["{Artist CleanName}"] = m => CleanTitle(artist.Name);
|
||||
tokenHandlers["{Artist NameThe}"] = m => TitleThe(artist.Name);
|
||||
tokenHandlers["{Artist Genre}"] = m => artist.Metadata.Value.Genres?.FirstOrDefault() ?? string.Empty;
|
||||
tokenHandlers["{Artist NameFirstCharacter}"] = m => TitleThe(artist.Name).Substring(0, 1).FirstCharToUpper();
|
||||
|
||||
if (artist.Metadata.Value.Disambiguation != null)
|
||||
|
@ -281,6 +282,7 @@ namespace NzbDrone.Core.Organizer
|
|||
tokenHandlers["{Album CleanTitle}"] = m => CleanTitle(album.Title);
|
||||
tokenHandlers["{Album TitleThe}"] = m => TitleThe(album.Title);
|
||||
tokenHandlers["{Album Type}"] = m => album.AlbumType;
|
||||
tokenHandlers["{Album Genre}"] = m => album.Genres.FirstOrDefault() ?? string.Empty;
|
||||
|
||||
if (album.Disambiguation != null)
|
||||
{
|
||||
|
|
|
@ -32,7 +32,8 @@ namespace NzbDrone.Core.Organizer
|
|||
var artistMetadata = new ArtistMetadata
|
||||
{
|
||||
Name = "The Artist Name",
|
||||
Disambiguation = "US Rock Band"
|
||||
Disambiguation = "US Rock Band",
|
||||
Genres = new List<string> { "Pop" }
|
||||
};
|
||||
|
||||
_standardArtist = new Artist
|
||||
|
@ -46,6 +47,7 @@ namespace NzbDrone.Core.Organizer
|
|||
ReleaseDate = System.DateTime.Today,
|
||||
AlbumType = "Album",
|
||||
Disambiguation = "The Best Album",
|
||||
Genres = new List<string> { "Rock" }
|
||||
};
|
||||
|
||||
_singleRelease = new AlbumRelease
|
||||
|
|
Loading…
Reference in New Issue