Path config and album-level flexible ttributes (at import time)


#1

Hi,

first of all, thanks for the code. It’s been a long time since I needed something like that.

Now, my question: I have an album-level flexible attribute I call “supergenre” which serves as a general categorisation for my music : I just want to keep Pop music separate from Classical music and organize their paths in a different way. So, I usually set that attribute at import time with a “set” argument.

Unfortunately, I can’t find a way to make it work with paths configuration. It will organize the album’s path by the default rule. A subsequent beet move won’t do either.

So, how can I make path configuration work with album level flexible attributes?

(Sorry if this has been answered before)


#2

Hmm; that sounds bad! It should certainly be possible to use a field assigned with a --set flag to sort your music into directories. Can you paste the relevant parts of the config you’re using and a description what you’re seeing happen after import?


#3

The assign part works good. It’s just that it does not match the query.

Here is the configuration (I include the inline config also, for clarity):

item_fields:
    initial: (albumartist_sort or artist_sort or albumartist or artist or '_')[0].upper()
    disc_count:  u'%02i.' % (disc)
    disc_and_track: u'%02i.%02i' % (disc, track) if
                    disctotal > 1 else u'%02i' % (track)
    definite_year: u'%04i' % original_year or original_date[:3] or year or date[:3] or 0

album_fields:
    cond_release_category: |
            if albumstatus.lower()=='official':
                    if albumtype.lower() in ['album', 'compilation', 'ep']:
                            return None
                    elif supergenre=='Soundtrack' and albumtype.lower() in ['soundtrack']:
                            return None
                    else:
                            return albumtype.capitalize()
            else:
                    return albumstatus.capitalize()
    boxset_folder: |
            if boxset==1:
                    boxdisc_folder=u'%i. %s' % disc, disctitle
                    if boxdisc_year: boxdisc_folder=u'%s %s' % boxdisc_folder, boxdisc_year
                    return boxdisc_folder
            else:
                    return None

paths:
    default: $supergenre/%asciify{$initial}/$albumartist/%if{$cond_release_category,$cond_release_category/}[$definite_year] $album%aunique{albumartist album,albumdisambig label catalognum year}/$disc_and_track - $title
    boxset:1: $supergenre/%asciify{$initial}/$albumartist/%if{$cond_release_category,$cond_release_category/}[$definite_year] $album%aunique{albumartist album,albumdisambig label catalognum year}/$disc_count $disctitle%ifdef{boxdisc_year, ($boxdisc_year)}/$track - $title
    singleton: Non-Album/$artist - $title
    comp: $supergenre/Compilations/$album%aunique{}/$disc_and_track - $title
    supergenre:Soundtrack: Soundtrack/$album/%if{$disctotal>1,$disc.}$track $title

It looks like the path query fails because the supergenre attribute is defined at album level. For example:

user@beethost:~$ beet ls supergenre:Soundtrack
user@beethost:~$ beet ls -a supergenre:Soundtrack
...
Michael Nyman - The Piano
...
user@beethost:~$ ls -l /music/Soundtrack/N/Michael\ Nyman/
total 0
drwxrwxr-x 2 user user 0 Jan 26 08:50 [1993] The Piano

You can see that the path follows the default pattern. BTW, if I give the command ‘beet move’ it will remain unchanged.

Hope this helps.


#4

Aha! Yes, thanks for clarifying. I can see that those path queries might only match item-level fields.

Just to check: that listing does indicate that $supergenre in your template is being expanded correctly, right?


#5

Correct, no problem with expanding it.


#6

Got it; thanks. This now sounds like a pretty clear-cut bug—would you mind filing a GitHub issue? I don’t know exactly how to fix it, but we can at least look more closely…


#7

Sure, no problem. Going to copy the same info :slight_smile: