# Moving compilations with certain genres into the soundtracks folder?

**URL:** <https://discourse.beets.io/t/moving-compilations-with-certain-genres-into-the-soundtracks-folder/421>\
**Category:** Help\
**Created:** [July 17, 2018, 7:09am UTC](https://discourse.beets.io/t/moving-compilations-with-certain-genres-into-the-soundtracks-folder/421 "2018-07-17T07:09:13Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![nohface](https://avatars.discourse-cdn.com/v4/letter/n/6bbea6/32.png) [@nohface](https://discourse.beets.io/u/nohface)\
**Post date:** [July 17, 2018, 7:09am UTC](https://discourse.beets.io/t/moving-compilations-with-certain-genres-into-the-soundtracks-folder/421/1 "2018-07-17T07:09:13Z")

</div>

My code:

```
# Move compilations from comp folder to soundtracks if a soundtrack
album_fields:
    grouped: 1 if genre in ("Anime Soundrack", "Soundtrack") or albumtype == 'soundtrack' else 0

albumtype_soundtrack: '_Soundtracks/%if{$grouped, %the{$grouping}}/[%if{$year,$year,0000}] $album %aunique{}/%if{$multidisc,Disc $disc/$disc-}$track. $title'

```

I can’t get the `grouped` field to do what I want. I was hoping that when I did `beet update` or `beet move`, they would use the genres I added in post and move to the appropriate folder(s).

Example: I tag an album with the “grouping” Naruto and the “genre” Anime Soundtrack. Upon move or update or w/e, this album should go into the \_Soundtracks folder and into a Naruto folder. But nothing happens. I can’t even get most of my soundtrack albums to go to the \_Soundtracks folder ☹ and I used the order of precedence so that comps are placed if an album isn’t a soundtrack.

---

<div class="post-metadata">

**Author:** ![adrian](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/adrian/32/4_2.png) [@adrian](https://discourse.beets.io/u/adrian)\
**Post date:** [July 17, 2018, 11:52am UTC](https://discourse.beets.io/t/moving-compilations-with-certain-genres-into-the-soundtracks-folder/421/2 "2018-07-17T11:52:06Z")

</div>

Nothing looks out of sorts from here. Do the fields seem to work with the `list` command?

What’s your `paths` configuration like? (Is that last line indented under it?)

---

<div class="post-metadata">

**Author:** ![nohface](https://avatars.discourse-cdn.com/v4/letter/n/6bbea6/32.png) [@nohface](https://discourse.beets.io/u/nohface)\
**Post date:** [July 17, 2018, 12:01pm UTC](https://discourse.beets.io/t/moving-compilations-with-certain-genres-into-the-soundtracks-folder/421/3 "2018-07-17T12:01:20Z")

</div>

That’s my soundtracks path, second only to the default path (order of precedence and all).

```
default: '%bucket{%upper{%left{%the{$albumartist},1}}}/%the{$albumartist}/[%if{$year,$year,0000}] $album %aunique{}/%if{$multidisc,Disc $disc/$disc-}$track. $title'

albumtype_soundtrack: '_Soundtracks/%if{$grouped, %the{$grouping}}/[%if{$year,$year,0000}] $album %aunique{}/%if{$multidisc,Disc $disc/$disc-}$track. $title'

comp: '_Compilations/%if{$grouped, %the{$grouping}}/[%if{$year,$year,0000}] $album %aunique{}/%if{$multidisc,Disc $disc/$disc-}$track. $title'

singleton: _Singletons/%the{$artist}/$title

```

[Misunderstood what you meant, so I removed the chunk of text related to that misunderstanding]

You meant something like `beet list $grouping` or `beet list $grouped`, right? Yes, they populate the appropriate entries.

---

<div class="post-metadata">

**Author:** ![adrian](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/adrian/32/4_2.png) [@adrian](https://discourse.beets.io/u/adrian)\
**Post date:** [July 17, 2018, 1:41pm UTC](https://discourse.beets.io/t/moving-compilations-with-certain-genres-into-the-soundtracks-folder/421/4 "2018-07-17T13:41:21Z")

</div>

Hmm—I still can’t quite tell from this listing: are all of those indented under the `paths:` section? As in the example in the docs:  
[http://docs.beets.io/en/v1.4.7/reference/config.html#path-format-configuration](http://docs.beets.io/en/v1.4.7/reference/config.html#path-format-configuration)

---

<div class="post-metadata">

**Author:** ![nohface](https://avatars.discourse-cdn.com/v4/letter/n/6bbea6/32.png) [@nohface](https://discourse.beets.io/u/nohface)\
**Post date:** [July 17, 2018, 4:16pm UTC](https://discourse.beets.io/t/moving-compilations-with-certain-genres-into-the-soundtracks-folder/421/5 "2018-07-17T16:16:55Z")

</div>

Yes, they are. Config below:

```auto
lyrics:
    bing_lang_from: []
    auto: yes
    fallback: ''
    force: no
    genius_api_key: REDACTED
    google_engine_ID: REDACTED
    sources:
    - google
    - lyricwiki
    - musixmatch
    - genius
    bing_lang_to:
    bing_client_secret: REDACTED
    google_API_key: REDACTED
    local: no
verbose: 0
asciify_paths: no
max_filename_length: 0
library: beets_library.db

replace:
    '[\\/]': ''
    ^\.: _
    \.$: _
    '[\x00-\x1f]': _
    '[<>"\*\|]': _
    \s+$: ''
    ^\s+: ''
    '[\?]': ''
    '[\*]': ''
    '[\.]{3}$': ''
    '[\:]': ''
original_date: no
ftintitle:
    auto: yes
    format: feat. {0}
    drop: no

clutter:
- Thumbs.DB
- .DS_Store
- '*.m3u'
- '*.html'
- '*.htm'
copyartifacts:
    extensions: .cue .log .jpg .png
    print_ignored: yes

plugins:
- discogs
- fromfilename
- edit
- embedart
- fetchart
- ftintitle
- lastgenre
- lyrics
- metasync
- scrub
- mbsync
- bucket
- inline
- the
- badfiles
- copyartifacts
- duplicates
- info
- missing
ignore_hidden: yes

paths:
    default: '%bucket{%upper{%left{%the{$albumartist},1}}}/%the{$albumartist}/[%if{$year,$year,0000}] $album %aunique{}/%if{$multidisc,Disc $disc/$disc-}$track. $title'
    albumtype_soundtrack: _Soundtracks/%if{$grouped, %the{$grouping}}/[%if{$year,$year,0000}] $album %aunique{}/%if{$multidisc,Disc $disc/$disc-}$track. $title
    comp: _Compilations/%if{$grouped, %the{$grouping}}/[%if{$year,$year,0000}] $album %aunique{}/%if{$multidisc,Disc $disc/$disc-}$track. $title
    singleton: _Singltons/%the{$artist}/$title
    ext:log: $albumpath/Extras/$artist - %asciify{$album}
    ext:cue: $albumpath/Extras/$artist - %asciify{$album}
    ext:jpg: $albumpath/Extras/%asciify{albumart_$album}
    ext:png: $albumpath/Extras/%asciify{albumart_$album}

format_item: $artist - $album - $title
sort_case_insensitive: yes
art_filename: '%asciify{albumart_$album}'
missing:
    format: $albumartist - $album - $track - $title
    count: no
    total: no
    album: no
format_album: $albumartist - $album
lastgenre:
    auto: yes
    fallback: ''
    source: artist
    count: 1
    prefer_specific: no
    force: yes
    min_weight: 10
    whitelist: yes
    separator: ', '
    canonical: no
path_sep_replace: _

import:
    log: ~/beets-import.log
    write: yes
    copy: yes
    group_albums: yes
    pretend: no
    search_ids: []
    duplicate_action: ask
    bell: yes
    set_fields: {}
    autotag: yes
    timid: yes
    resume: ask
    incremental: no
    incremental_skip_later: no
    quiet_fallback: skip
    none_rec_action: ask
    default_action: apply
    singletons: no
    languages: []
    detail: no
    flat: no

sort_album: albumartist+ album+

match:
    strong_rec_thresh: 0.04
    medium_rec_thresh: 0.25
    rec_gap_thresh: 0.25
    max_rec:
        missing_tracks: medium
        unmatched_tracks: medium
    distance_weights:
        source: 2.0
        artist: 3.0
        album: 3.0
        media: 1.0
        mediums: 1.0
        year: 1.0
        country: 0.5
        label: 0.5
        catalognum: 0.5
        albumdisambig: 0.5
        album_id: 5.0
        tracks: 2.0
        missing_tracks: 0.9
        unmatched_tracks: 0.6
        track_title: 3.0
        track_artist: 2.0
        track_index: 1.0
        track_length: 2.0
        track_id: 5.0
    preferred:
        countries: []
        media: []
        original_year: no
    ignored: []
    required: []
    track_length_grace: 10
    track_length_max: 30
scrub:
    auto: no
artist_credit: no
fetchart:
    auto: yes
    minwidth: 500
    maxwidth: 1000
    cautious: yes
    cover_names: cover folder album front
    sources: filesystem coverart amazon itunes albumart
    google_engine: 001452825323518960753:hrh5ch1gjzm
    enforce_ratio: no
    store_source: no
    google_key: REDACTED
    fanarttv_key: REDACTED
embedart:
    auto: yes
    compare_threshold: 0
    ifempty: no
    remove_art_file: no
    maxwidth: 0
time_format: '%Y-%m-%d %H:%M:%S'
pluginpath: [~\AppData\Roaming\beets\beetsplug]
item_fields:
    multidisc: 1 if disctotal > 1 else 0
sort_item: artist+ album+ disc+ track+
threaded: yes
va_name: Various Artists
per_disc_numbering: yes
id3v23: yes
bucket:
    bucket_alpha:
    - 0-9
    - A-D
    - E-H
    - I-L
    - M-P
    - Q-U
    - V-Z
    bucket_year: []
    extrapolate: no
    bucket_alpha_regex: {}
ignore:
- .*
- '*~'
- System Volume Information
- lost+found
- .DS_Store
- desktop.ini
- AlbumArtSmall.jpg
- AlbumArt_*_Small.jpg
album_fields:
    grouped: 1 if genre in ("Anime Soundrack", "Soundtrack") or albumtype == 'soundtrack' else 0

ui:
    terminal_width: 80
    length_diff_thresh: 10.0
    color: yes
timeout: 5.0
directory: ~/Music
format_raw_length: no
the:
    a: yes
    patterns: []
    the: yes
    strip: no
    format: '{0}, {1}'
pathfields: {}
discogs:
    tokenfile: discogs_token.json
    user_token: REDACTED
    apikey: REDACTED
    apisecret: REDACTED
    source_weight: 0.5
duplicates:
    count: no
    full: no
    format: ''
    keys: []
    move: ''
    tag: ''
    path: no
    copy: ''
    tiebreak: {}
    album: no
    strict: no
    checksum: ''
    merge: no
    delete: no
edit:
    itemfields: track title artist album
    albumfields: album albumartist
    ignore_fields: id path

```

---

<div class="post-metadata">

**Author:** ![adrian](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/adrian/32/4_2.png) [@adrian](https://discourse.beets.io/u/adrian)\
**Post date:** [July 17, 2018, 4:51pm UTC](https://discourse.beets.io/t/moving-compilations-with-certain-genres-into-the-soundtracks-folder/421/6 "2018-07-17T16:51:35Z")

</div>

I see; thanks!

It would be useful to break down your configuration one step at a time to see which piece is going wrong. Start with the `$grouped` field to see if it seems to have the right value; then use it in an `%if` to see if that works too, then use it in the real expression you want. Separately, try using the `albumtype_soundtrack` key _without_ the path formatting instructions you want. Using this process of elimination, you can find out exactly which piece needs fixing.

---

<div class="post-metadata">

**Author:** ![nohface](https://avatars.discourse-cdn.com/v4/letter/n/6bbea6/32.png) [@nohface](https://discourse.beets.io/u/nohface)\
**Post date:** [July 21, 2018, 4:53am UTC](https://discourse.beets.io/t/moving-compilations-with-certain-genres-into-the-soundtracks-folder/421/7 "2018-07-21T04:53:05Z")

</div>

I only attempted the `$grouped` value query as of now. Here are my results (along with some other queries):

Reminder of relevant line in config:

```auto
album_fields:
    grouped: 1 if genre in ("Anime Soundrack", "Soundtrack") or albumtype == 'soundtrack' else 0

```

```auto
PS C:\Users\user1> beet ls -af '$album: $grouped' NANA
NANA 707 Soundtracks: 0
NANA 7to8 soundtracks: 0

PS C:\Users\user1> beet ls -af '$album: $grouping' NANA
NANA 707 Soundtracks: $grouping
NANA 7to8 soundtracks: $grouping

PS C:\Users\user1> beet ls -af '$album: $genre' NANA
NANA 707 Soundtracks: Anime Soundtrack
NANA 7to8 soundtracks: Anime Soundtrack

-------------------

PS C:\Users\user1> beet ls -af '$album: $grouped' Violet Evergarden
Violet Evergarden Vocal Album Song Letters: 1

PS C:\Users\user1> beet ls -af '$album: $grouping' Violet Evergarden
Violet Evergarden Vocal Album Song Letters: $grouping

-------------------

PS C:\Users\user1> beet ls -af '$album: $grouped'
juice: 0
Bokura no Ekisu (πâ£πé»πéëπü«πé¿πé¡πé╣): 0
Buritora Golden Best: 0
MADE IN ABYSS ORIGINAL SOUNDTRACK: 1
Supernatural: 0
Time to Say Goodbye: 0
Hot Shot: 0
Ocean of Love (µä¢σâÅσñºµ╡╖): 0
Permission To Land: 0
Hibana: 0
NANA 707 Soundtracks: 0
NANA 7to8 soundtracks: 0
Violet Evergarden Vocal Album Song Letters: 1

-------------------

PS C:\Users\user1> beet ls -af '$album: $grouping'
Bokura no Ekisu (πâ£πé»πéëπü«πé¿πé¡πé╣): $grouping
Buritora Golden Best: $grouping
MADE IN ABYSS ORIGINAL SOUNDTRACK: $grouping
Supernatural: $grouping
Time to Say Goodbye: $grouping
Hot Shot: $grouping
Ocean of Love (µä¢σâÅσñºµ╡╖): $grouping
Permission To Land: $grouping
Hibana: $grouping
NANA 707 Soundtracks: $grouping
NANA 7to8 soundtracks: $grouping
Violet Evergarden Vocal Album Song Letters: $grouping

-------------------

PS C:\Users\user1> beet ls -af '$album: $genre'
Bokura no Ekisu (πâ£πé»πéëπü«πé¿πé¡πé╣): J-Pop; Parody; Comedy
Buritora Golden Best: J-Pop; Parody; Comedy
MADE IN ABYSS ORIGINAL SOUNDTRACK: Anime Soundtrack
Supernatural: Rock
Time to Say Goodbye: Operatic Pop
Hot Shot: Reggae
Ocean of Love (µä¢σâÅσñºµ╡╖): C-Pop
Permission To Land: Rock
Hibana: J-Rock
NANA 707 Soundtracks: Anime Soundtrack
NANA 7to8 soundtracks: Anime Soundtrack
Violet Evergarden Vocal Album Song Letters: Anime Soundtrack

PS C:\Users\user1> beet ls -af '$album: $albumtype'
Bokura no Ekisu (πâ£πé»πéëπü«πé¿πé¡πé╣):
Buritora Golden Best:
Supernatural:
Time to Say Goodbye:
Hot Shot:
Ocean of Love (µä¢σâÅσñºµ╡╖):
Permission To Land:
Hibana: single
NANA 707 Soundtracks:
NANA 7to8 soundtracks:
Violet Evergarden Vocal Album Song Letters: soundtrack

```

Why would my `$grouping` be populated with the word `$grouping`?

---

<div class="post-metadata">

**Author:** ![adrian](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/adrian/32/4_2.png) [@adrian](https://discourse.beets.io/u/adrian)\
**Post date:** [July 21, 2018, 6:10pm UTC](https://discourse.beets.io/t/moving-compilations-with-certain-genres-into-the-soundtracks-folder/421/8 "2018-07-21T18:10:08Z")

</div>

That just indicates that that field is unset. Grouping is a track-level field, not an album-level field. You can get a list showing this using `beet fields`.

---

<div class="post-metadata">

**Author:** ![nohface](https://avatars.discourse-cdn.com/v4/letter/n/6bbea6/32.png) [@nohface](https://discourse.beets.io/u/nohface)\
**Post date:** [July 22, 2018, 11:08am UTC](https://discourse.beets.io/t/moving-compilations-with-certain-genres-into-the-soundtracks-folder/421/9 "2018-07-22T11:08:53Z")

</div>

Then, how about this:

### Creating a new album-level field `fandom`

```
album_fields:
    grouped: 1 if genre in ("Anime Soundtrack", "Soundtrack") or albumtype == 'soundtrack' else 0
    fandom: return grouping if grouping != ''

albumtype_soundtrack: '_Soundtracks/%if{$grouped, %the{$fandom}}/[%if{$year,$year,0000}] $album %aunique{}/%if{$multidisc,Disc $disc/$disc-}$track. $title'
```
