Costum field in config.yaml to define paths options


#1

Hi,

I wonder if is possible to use custom fields to apply special path options in the configuration.

In my case there ist the custom field “homegrown” which can have the value “true”.

I added to the config.yaml

paths:
    default: $albumartist_credit/$album%aunique{}/$disc-$track $title
#    default: $albumartist/$album%aunique{}/$disc-$track $title
    homegrown:true: homegrown/$albumartist/$album%aunique{}/$disc/$disctitle/$disc-$track $title

I also tried just as it works with singleton for example:

homegrown: homegrown/$albumartist/$album%aunique{}/$disc/$disctitle/$disc-$track $title

But this path option is ignored whent performing a

beet move -p “some search with homegrown=true”

The custom field “homegrown” is set on the album level

I’m afraid according this doc-page custom fields don’t work with paths-config:

pathformat


#2

Everything looks fine from here! Flexible attributes should work fine there. I don’t see an obvious problem.


#3

Let’s test again

With now:

paths:
    #    default: $albumartist_credit/$album%aunique{}/$disc-$track $title
    #    default: $albumartist/$album%aunique{}/$disc-$track $title
        default: %asciify{$albumartist}/%asciify{$album}%aunique{}/$disc-$track %asciify{$title}
        homegrown:true: Homegrown/%asciify{$albumartist}/%asciify{$album}%aunique{}/$disc-$track %asciify{$title}
        album:Leonard Bernstein Collection Volume One: %asciify{$albumartist_credit}/%asciify{$album}%aunique{}/$disc/%asciify{$disctitle}/$disc-$track %asciify{$title}
        singleton: Non-Album/%asciify{$artist}/%asciify{$title}
        comp: Compilations/%asciify{$album}%aunique{}/$disc-$track %asciify{$title}

I choose this example files
(homegrown is set on the album level, but it is also visible with each track)

beet ls Wolfgang Dauner  -f '$homegrown $path'
true /marvin/mucke/beetOutput/_/Wolfgang_Dauner__Piano_solo_Köln_Subway/00-01_Wendekreis_des_Steinbocks.flac
true /marvin/mucke/beetOutput/_/Wolfgang_Dauner__Piano_solo_Köln_Subway/00-02_Don_t_change_me.flac
true /marvin/mucke/beetOutput/_/Wolfgang_Dauner__Piano_solo_Köln_Subway/00-03_Über_den_Dächern_von_Stuttgart.flac
true /marvin/mucke/beetOutput/_/Wolfgang_Dauner__Piano_solo_Köln_Subway/00-04_Trans_Tanz.flac

Now I use ‘move -p’ and the default rule is applied instead:

beet move -p /marvin/mucke/beetOutput/_/Wolfgang_Dauner__Piano_solo_Köln_Subway/
    Moving 4 items.
    /marvin/mucke/beetOutput/_/Wolfgang_Dauner__Piano_solo_Köln_Subway/00-01_Wendekreis_des_Steinbocks.flac 
      -> /marvin/mucke/beetOutput/Wolfgang_Dauner/Wolfgang_Dauner__Piano_solo_Koln_Subway/00-01_Wendekreis_des_Steinbocks.flac
    /marvin/mucke/beetOutput/_/Wolfgang_Dauner__Piano_solo_Köln_Subway/00-02_Don_t_change_me.flac 
      -> /marvin/mucke/beetOutput/Wolfgang_Dauner/Wolfgang_Dauner__Piano_solo_Koln_Subway/00-02_Don_t_change_me.flac
    /marvin/mucke/beetOutput/_/Wolfgang_Dauner__Piano_solo_Köln_Subway/00-03_Über_den_Dächern_von_Stuttgart.flac 
      -> /marvin/mucke/beetOutput/Wolfgang_Dauner/Wolfgang_Dauner__Piano_solo_Koln_Subway/00-03_Uber_den_Dachern_von_Stuttgart.flac
    /marvin/mucke/beetOutput/_/Wolfgang_Dauner__Piano_solo_Köln_Subway/00-04_Trans_Tanz.flac 
      -> /marvin/mucke/beetOutput/Wolfgang_Dauner/Wolfgang_Dauner__Piano_solo_Koln_Subway/00-04_Trans_Tanz.flac

I use the beets which comes with debian stable:
beets version 1.3.18
plugins: chroma, convert, edit, embedart, lastgenre, mbsync, smartplaylist, web

What could I do to check it better ?


#4

Try setting it on the track level. Path queries don’t work with album-level fields: https://github.com/beetbox/beets/issues/2797


#5

Ok, thanks for the link to the issue.

For my “requirements” I’m going to solve the path naming by using albumartist again instead of albumartist_credit. So there is no urgent to create a parent directory “homegrown” any more (to avoid the ‘_’ due to the empy albumartist_credit with no-musicbrainz (homegrown) releases.

A few month ago I switched to albumartist_credit to avoid artist directories on base of non-latin artist names.


Finally another hint: it doesn’t work with a non-path query either:

beet move -p  Wolfgang Dauner Piano solo
Moving 4 items.
/marvin/mucke/beetOutput/_/Wolfgang_Dauner__Piano_solo_Köln_Subway/00-01_Wendekreis_des_Steinbocks.flac 
  -> /marvin/mucke/beetOutput/Wolfgang_Dauner/Wolfgang_Dauner__Piano_solo_Koln_Subway/00-01_Wendekreis_des_Steinbocks.flac
/marvin/mucke/beetOutput/_/Wolfgang_Dauner__Piano_solo_Köln_Subway/00-02_Don_t_change_me.flac 
  -> /marvin/mucke/beetOutput/Wolfgang_Dauner/Wolfgang_Dauner__Piano_solo_Koln_Subway/00-02_Don_t_change_me.flac
/marvin/mucke/beetOutput/_/Wolfgang_Dauner__Piano_solo_Köln_Subway/00-03_Über_den_Dächern_von_Stuttgart.flac 
  -> /marvin/mucke/beetOutput/Wolfgang_Dauner/Wolfgang_Dauner__Piano_solo_Koln_Subway/00-03_Uber_den_Dachern_von_Stuttgart.flac
/marvin/mucke/beetOutput/_/Wolfgang_Dauner__Piano_solo_Köln_Subway/00-04_Trans_Tanz.flac 
  -> /marvin/mucke/beetOutput/Wolfgang_Dauner/Wolfgang_Dauner__Piano_solo_Koln_Subway/00-04_Trans_Tanz.flac

#6

Finally I can confirm now:
Setting the attribute on the track level as well worked (while setting it tracks where moved accordingly !) .

Thanks again for the hint !


#7

While moving all those dirs/tracks beets didn’t move the external cover art “cover.jpg”.
Do I have to configure a special option for that ?


#8

You will need fetchart enabled to pick up those files, but otherwise it should work out of the box.


#9

I’m not shure if I got it correctly.
“otherwise it should work out of the box”, even with fetchart disabled ?

I’m not using to select and provide pictures by myself .

My config isn’t very sophisticated:

paths:
    default: $albumartist/$album%aunique{}/$disc-$track $title
    homegrown:true: Homegrown/$albumartist/$album%aunique{}/$disc-$track $title
    album:Leonard Bernstein Collection Volume One: $albumartist_credit/$album%aunique{}/$disc/$disctitle/$disc-$track $title
    singleton: Non-Album/$artist/$title
    comp: Compilations/$album%aunique{}/$disc-$track $title
convert:
    dest: ~/converted_music
    copy_album_art: yes
    formats:
        mp3: ffmpeg -i $source -acodec libmp3lame -b:a 320k $dest
        alac:
            command: ffmpeg -i $source -y -vn -acodec alac $dest
            extension: m4a
        aac:
            command: ffmpeg -i $source -y -vn -acodec libfaac -aq 100 $dest
            extension: m4a
        opus: ffmpeg -i $source -y -vn -acodec libopus -ab 96k $dest
        flac: ffmpeg -i $source -y -vn -acodec flac $dest
        ogg: ffmpeg -i $source -y -vn -acodec libvorbis -aq 3 $dest
        wma: ffmpeg -i $source -y -vn -acodec wmav2 -vn $dest
    never_convert_lossy_files: no
    album_art_maxwidth: 0
    format: mp3
    auto: no
    threads: 4
    tmpdir:
    max_bitrate: 500

    paths: {}
    pretend: no
    quiet: no
    embed: yes
log: /marvin/mucke/beet.log
smartplaylist:
    relative_to: /marvin/mucke/beetOutput
    playlist_dir: ~/playlists
    playlists: [{query: 'genre::[Cc]lass|[Kk]lass|Barock|Chamber|Choral|Chorus|Gitarre|Guitar|Klavier|Medieval|Oper|Orchest|Renaiss', name: klassik.m3u}]
    auto: yes
chroma:
    auto: no
embedart:
    auto: no
    compare_threshold: 0
    ifempty: no
    remove_art_file: no
    maxwidth: 0

replace:
    ' ': _
    '[\\/]': _
    ^\.: _
    '[\x00-\x1f]': _
    '[<>:"\?\*\|;,\.]': _
    '[\(\)]': __
    \.$: _
    \s+$: ''
    ^\s+: ''
    '&': _
    \': _
    "\\\u2019": _
languages: en de es
edit:
    albumfields: album albumartist genre
    itemfields: track title artist album
    ignore_fields: id path
lastgenre:
    auto: yes
    whitelist: ~/.config/beets/whitelist.yaml
    canonical: ~/.config/beets/genres-tree.yaml
    force: no
    count: 1
    source: album
    min_weight: 10
    separator: ', '
    fallback:

plugins: convert smartplaylist mbsync  chroma embedart web lastgenre edit
directory: /marvin/mucke/beetOutput

import:
    languages: de en
    media: CD
acoustid:
    apikey: REDACTED
per_disc_numbering: yes
web:
    host: 127.0.0.1
    port: 8337
    cors: ''

#10

Sorry for the ambiguity. You will need that plugin enabled.

In the future, please use code blocks (instead of quotes) for your config so they stay readable.


#11

Thank you again for clarifying.

I’m going to try it with a restrictive configurartion

fetchart:
cautious: yes
minwidth: 500
maxwidth: 1000
cover_names: cover
auto: no
sources: filesystem
google_engine: 001442825323518660753:hrh5ch1gjzm
enforce_ratio: no
store_source: no
google_key: REDACTED
fanarttv_key: REDACTED