mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-15 01:23:53 -07:00
New: Album and Artist Genre Naming Tokens
This commit is contained in:
parent
f7548f9bb7
commit
ec41951ea5
4 changed files with 33 additions and 4 deletions
|
@ -47,7 +47,9 @@ const artistTokens = [
|
||||||
|
|
||||||
{ token: '{Artist CleanName}', example: 'Artist Name' },
|
{ token: '{Artist CleanName}', example: 'Artist Name' },
|
||||||
|
|
||||||
{ token: '{Artist Disambiguation}', example: 'Disambiguation' }
|
{ token: '{Artist Disambiguation}', example: 'Disambiguation' },
|
||||||
|
|
||||||
|
{ token: '{Artist Genre}', example: 'Pop' }
|
||||||
];
|
];
|
||||||
|
|
||||||
const albumTokens = [
|
const albumTokens = [
|
||||||
|
@ -59,7 +61,9 @@ const albumTokens = [
|
||||||
|
|
||||||
{ token: '{Album Type}', example: 'Album Type' },
|
{ token: '{Album Type}', example: 'Album Type' },
|
||||||
|
|
||||||
{ token: '{Album Disambiguation}', example: 'Disambiguation' }
|
{ token: '{Album Disambiguation}', example: 'Disambiguation' },
|
||||||
|
|
||||||
|
{ token: '{Album Genre}', example: 'Rock' }
|
||||||
];
|
];
|
||||||
|
|
||||||
const mediumTokens = [
|
const mediumTokens = [
|
||||||
|
|
|
@ -10,6 +10,7 @@ using NzbDrone.Core.Music;
|
||||||
using NzbDrone.Core.Organizer;
|
using NzbDrone.Core.Organizer;
|
||||||
using NzbDrone.Core.Qualities;
|
using NzbDrone.Core.Qualities;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
|
using TagLib;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
||||||
{
|
{
|
||||||
|
@ -37,7 +38,8 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
||||||
.With(s => s.Metadata = new ArtistMetadata
|
.With(s => s.Metadata = new ArtistMetadata
|
||||||
{
|
{
|
||||||
Disambiguation = "US Rock Band",
|
Disambiguation = "US Rock Band",
|
||||||
Name = "Linkin Park"
|
Name = "Linkin Park",
|
||||||
|
Genres = new List<string> { "Rock" }
|
||||||
})
|
})
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
@ -66,6 +68,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
||||||
.With(s => s.Title = "Hybrid Theory")
|
.With(s => s.Title = "Hybrid Theory")
|
||||||
.With(s => s.AlbumType = "Album")
|
.With(s => s.AlbumType = "Album")
|
||||||
.With(s => s.Disambiguation = "The Best Album")
|
.With(s => s.Disambiguation = "The Best Album")
|
||||||
|
.With(s => s.Genres = new List<string> { "Rock" })
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
_mixAlbum = Builder<Album>
|
_mixAlbum = Builder<Album>
|
||||||
|
@ -205,6 +208,15 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
||||||
.Should().Be("US Rock Band");
|
.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]
|
[Test]
|
||||||
public void should_replace_Album_space_Title()
|
public void should_replace_Album_space_Title()
|
||||||
{
|
{
|
||||||
|
@ -232,6 +244,15 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
||||||
.Should().Be("The Best Album");
|
.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]
|
[Test]
|
||||||
public void should_replace_Album_underscore_Title()
|
public void should_replace_Album_underscore_Title()
|
||||||
{
|
{
|
||||||
|
|
|
@ -267,6 +267,7 @@ 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);
|
||||||
|
tokenHandlers["{Artist Genre}"] = m => artist.Metadata.Value.Genres?.FirstOrDefault() ?? string.Empty;
|
||||||
tokenHandlers["{Artist NameFirstCharacter}"] = m => TitleThe(artist.Name).Substring(0, 1).FirstCharToUpper();
|
tokenHandlers["{Artist NameFirstCharacter}"] = m => TitleThe(artist.Name).Substring(0, 1).FirstCharToUpper();
|
||||||
|
|
||||||
if (artist.Metadata.Value.Disambiguation != null)
|
if (artist.Metadata.Value.Disambiguation != null)
|
||||||
|
@ -281,6 +282,7 @@ namespace NzbDrone.Core.Organizer
|
||||||
tokenHandlers["{Album CleanTitle}"] = m => CleanTitle(album.Title);
|
tokenHandlers["{Album CleanTitle}"] = m => CleanTitle(album.Title);
|
||||||
tokenHandlers["{Album TitleThe}"] = m => TitleThe(album.Title);
|
tokenHandlers["{Album TitleThe}"] = m => TitleThe(album.Title);
|
||||||
tokenHandlers["{Album Type}"] = m => album.AlbumType;
|
tokenHandlers["{Album Type}"] = m => album.AlbumType;
|
||||||
|
tokenHandlers["{Album Genre}"] = m => album.Genres.FirstOrDefault() ?? string.Empty;
|
||||||
|
|
||||||
if (album.Disambiguation != null)
|
if (album.Disambiguation != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,7 +32,8 @@ namespace NzbDrone.Core.Organizer
|
||||||
var artistMetadata = new ArtistMetadata
|
var artistMetadata = new ArtistMetadata
|
||||||
{
|
{
|
||||||
Name = "The Artist Name",
|
Name = "The Artist Name",
|
||||||
Disambiguation = "US Rock Band"
|
Disambiguation = "US Rock Band",
|
||||||
|
Genres = new List<string> { "Pop" }
|
||||||
};
|
};
|
||||||
|
|
||||||
_standardArtist = new Artist
|
_standardArtist = new Artist
|
||||||
|
@ -46,6 +47,7 @@ namespace NzbDrone.Core.Organizer
|
||||||
ReleaseDate = System.DateTime.Today,
|
ReleaseDate = System.DateTime.Today,
|
||||||
AlbumType = "Album",
|
AlbumType = "Album",
|
||||||
Disambiguation = "The Best Album",
|
Disambiguation = "The Best Album",
|
||||||
|
Genres = new List<string> { "Rock" }
|
||||||
};
|
};
|
||||||
|
|
||||||
_singleRelease = new AlbumRelease
|
_singleRelease = new AlbumRelease
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue