-
-
Notifications
You must be signed in to change notification settings - Fork 299
New: Token for track artist (as opposed to album artist) #1910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -279,6 +280,16 @@ private void AddArtistTokens(Dictionary<string, Func<TokenMatch, string>> tokenH | |||
} | |||
} | |||
|
|||
private void AddTrackArtistTokens(Dictionary<string, Func<TokenMatch, string>> tokenHandlers, List<Track> tracks) | |||
{ | |||
var artists = tracks.Select(t => t.ArtistMetadata.Value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the difference between Artist
and ArtistMetadata
in the data model? It looks like Artist
is still "Various Artists" for these tracks, but ArtistMetadata
is the correct artist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Artist
is the actual record that we follow in the db (monitored or not, profiles are attached to, etc...) ArtistMetadata
is basically the data record for a given artist, it can be attached to an artist object or a track object.
@@ -122,6 +122,7 @@ public string BuildTrackFileName(List<Track> tracks, Artist artist, Album album, | |||
AddAlbumTokens(tokenHandlers, album); | |||
AddMediumTokens(tokenHandlers, tracks.First().AlbumRelease.Value.Media.SingleOrDefault(m => m.Number == tracks.First().MediumNumber)); | |||
AddTrackTokens(tokenHandlers, tracks); | |||
AddTrackArtistTokens(tokenHandlers, tracks); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic can be added to AddTrackTokens
instead of making a new module given this is track metadata
.DistinctBy(a => a.Name) | ||
.ToList(); | ||
|
||
tokenHandlers["{Track ArtistName}"] = m => string.Join("+", artists.Select(a => a.Name)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to list these all and join by "+" or do we just want the first? should we have different tokens? @ta264 thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Qstick What does it mean if there's multiple tracks in the list? I copied the +
joining based on what {Track Title}
does but I didn't quite understand why it takes a List instead of just one Track..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lidarr is like Sonarr in that it supports 1 file = multiple tracks. So a particular file can be associated with multiple tracks.. Ex. Single file album.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll update it to just use the first one.
I can fix the broken tests once I get some confirmation that my approach is reasonable. cc @ta264 |
Sure, I'll try to rebase and update the tests over the weekend if I get some free time :) |
@Qstick I think this is ready for review now. I rebased and fixed a few issues. |
Database Migration
NO
Description
Adds a new
{Track ArtistName}
token that contains the track's artist name, not the album's artist name. This is primarily useful with "Various Artists" albums.I originally tried calling it
{Track Artist Name}
but theTitleRegex
only allows a single space in the token name, so I went with{Track ArtistName}
instead. Let me know if you'd prefer some other token.Before:

After:

Todos
Issues Fixed or Closed by this PR