Some albums moved under "_" artist upon import

After importing my music collection into beets, I noticed that some albums end up getting imported under a folder with “_” as the artist name, e.g.

/music
  /artist1
  /artist2
  /artist3
  /...
  /Various Artists
  /_               <-------------------
    /album1
    /album2

However, if I inspect with beet ls, I can see that the items there (e.g. album1 and album2 in the example above) contain the correct artist and albumartist tags.

Is this a known issue? and how can I fix this situation?

Any input greatly appreciated. Thanks!

Hmm… it’s hard to tell what’s going wrong at this high level of abstraction. Can you please include your configuration and the actual output of the beet ls command showing what’s going wrong?

Sorry for the lack of details. Here’s some more context.

Here is my config.yaml:

directory: /bigtank/audio/music
library: /bigtank/audio/beets_music.db
import:
  incremental_skip_later: yes
paths:
  comp: Various Artists/$album%aunique{}/$track - $artist - $title
  singleton: Non-Album/$artist_sort/$title
  default: $albumartist_sort/$album%aunique{}/$track - $title
plugins: chroma copyartifacts discogs fromfilename
chroma:
  auto: no
acoustid:
  apikey: <deleted>
copyartifacts:
    extensions: .*
    print_ignored: yes
discogs:
  user_token: <deleted>

Here is some output from beet ls for 1 album that is affected by this issue (Prefab Sprout’s Steve McQueen acoustic recording). Approximately 2% of the albums I imported ended up this way (under “_” artist):

$ beet ls -p album:"Steve McQueen"
/bigtank/audio/music/_/Steve McQueen Acoustic/01 - Appetite.mp3
/bigtank/audio/music/_/Steve McQueen Acoustic/02 - Bonny.mp3
/bigtank/audio/music/_/Steve McQueen Acoustic/03 - Desire As.mp3
/bigtank/audio/music/_/Steve McQueen Acoustic/04 - When Love Breaks Down.mp3
/bigtank/audio/music/_/Steve McQueen Acoustic/05 - Goodbye Lucille #1.mp3
/bigtank/audio/music/_/Steve McQueen Acoustic/06 - Moving The River.mp3
/bigtank/audio/music/_/Steve McQueen Acoustic/07 - Faron Young.mp3
/bigtank/audio/music/_/Steve McQueen Acoustic/08 - When The Angels.mp3

$ beet ls -f '$albumartist:$artist:$title' album:"Steve McQueen"
Prefab Sprout:Prefab Sprout:Appetite
Prefab Sprout:Prefab Sprout:Bonny
Prefab Sprout:Prefab Sprout:Desire As
Prefab Sprout:Prefab Sprout:When Love Breaks Down
Prefab Sprout:Prefab Sprout:Goodbye Lucille #1
Prefab Sprout:Prefab Sprout:Moving The River
Prefab Sprout:Prefab Sprout:Faron Young
Prefab Sprout:Prefab Sprout:When The Angels

Note that the second beet ls command verifies that beets understands the $artist and $albumartist fields is “Prefab Sprout”, but the import placed them under “/bigtank/audio/music/_/”

Hmm, some added information. It looks like this only happens on albums imported using metadata sourced from discogs:

$ beet ls -f '$albumartist:$path:$data_source' path:"/bigtank/audio/music/_/" data_source:Discogs | wc -l
1957
$ beet ls -f '$albumartist:$path:$data_source' path:"/bigtank/audio/music/_/" ^data_source:Discogs | wc -l
0

Note however, that there are some albums imported using metadata sourced from discogs that are not affected by this issue:

$ beet ls -f '$albumartist:$path:$data_source' ^path:"/bigtank/audio/music/_/" data_source:Discogs | wc -l
342

I notice that your path format uses $albumartist_sort. Can you check whether that field is missing? (It’s likely to be missing in Discogs, which IIRC doesn’t provide this field.)

Thanks, looks like that’s the issue. Indeed $albumartist_sort is empty for all these albums. What would your suggested fix be? I suppose I could use beet modify to manually populate these missing fields, but this would continue to happen for future imports. Where does $albumartist_sort usually get computed?

It’s not automatically calculated—it comes from MusicBrainz, i.e., the blood, sweat, and tears of human volunteers who think carefully about what the sort name for an artist should be. :smiley:

You might consider using the artist name as a fallback, like %if{$albumartist_sort,$albumartist_sort,$albumartist}.

Thank you so much for the clarification about $albumartist_sort :sweat_smile:
I experimented with using fallbacks, but in the end decided that I didn’t want to compromise, having spent so much time on manually fixing lots of other metadata. So I’ve now come up with a workflow where I can extract such problematic cases, enter the correct $albumartist_sort field, and then modify the tags.

1 Like

Awesome!!

For what it’s worth, I sense an opportunity for a plugin to help with cases like this. A hypothetical plugin could “guess” sort names based on a few heuristics (e.g., move “The” to the end; if the name looks sort of like a first and last name, invert them) and then ask for human approval. It could even try to use MusicBrainz to look up sort names, even when the original match didn’t come from MB, just by searching for an artist with the given name. Could be cool!