Track genre as variable in path

Hi!
im a new user of beets and i don’t know if this is already a feature or not. and i love it btw.
I need to use the genre of the tracks in the paths but the variable $genres only refers to the album genre and there is not a variable for the track genre.
this is tricky becouse with this config:

default: $genre/$albumartist/$album%aunique{}/$track $title

i have tracks with House genre in the “Deep House” folder.
Maybe im using it wrong.
There is a way to use the track genre or a way to access it ?

Good question—this is a little tricky because, in general, it’s hard to disambiguate track-level information from album-level information of the same name.

One thing you might try is to use the inline plugin. Define a new track-level field that just remaps genre to a new name:

item_fields:
    track_genre: genre

Then use $track_genre in your path formats. I think this should probably work?

Works perfectly!
Thanks adrian!

This seems odd, aren’t path formats evaluated against the item? I’d expect it to prefer the item field and fall back to the album, not the other way around, unless used in the format_album format.

There is actually a special formatting mode for paths that makes album-level information take precedence:

This is important because most people include album-level fields in their paths when they want to group albums together. So a path like $genre/$artist/$album would, by default, get “broken up” into different directories if the $genre field differed across items. Preferring album-level data keeps things coalesced together as much as possible.

Ah! Thanks, that clarifies it. Not sure how I missed that one.