Put music in subfolder if album consists of multiple discs

All about user-defined episode / movie / file name format expressions
Post Reply
johanruda
Posts: 1
Joined: 07 Aug 2015, 05:00

Put music in subfolder if album consists of multiple discs

Post by johanruda »

Hi!

First of all, sorry for placing this under the episode/movie forum, but I wasn't sure whereelse to put it.

I'm using Filebot to clean up my music library at the moment, but I've ran in to a problem.
I have some albums that consists of multiple discs and I would like Filebot to put the songs in disc subfolders like this:

E:/Musik/Artist/Album/CD 1/1 - Song name.mp3

I've found that this works:

Code: Select all

E:/Musik/{albumartist}/{y} - {album}/CD {media.'part/position'}/{pi} -  {t}
However, this also means that albums that consists of only 1 disc get put in a subfolder called "CD " (without a disc number).
Is it possible to have Filebot sort the music into disc subfolder IF the album consists of multiple discs and only then?
User avatar
rednoah
The Source
Posts: 23504
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Put music in subfolder if album consists of multiple dis

Post by rednoah »

Please read up on the The Unwind-on-Undefined Behaviour:
viewtopic.php?f=5&t=1895

Solution:

Code: Select all

{'/CD '+media.'part/position'}


PS: you might wanna use {n} instead of {albumartist} because {n} is defined as getAlbumArtist() != null ? getAlbumArtist() : getArtist();
:idea: Please read the FAQ and How to Request Help.
r0b1n
Posts: 1
Joined: 09 Jun 2023, 09:46

Re: Put music in subfolder if album consists of multiple discs

Post by r0b1n »

Hi there.
I realise this is an old thread but would like to achieve exactly what was described here.
I've tried the code solution proposed above but it doesn't work for me.

I'm using two audio assets to test this:

Asset A contains no value for media.part
Asset B contains a value of 2 for media.part

Test 1
Using the following syntax, including the suggested code snippet:

Code: Select all

{artist}/{album} ({y})/{'/CD '+media.'part/position'}/{pi.pad(2)} - {t} - ({aco} {af} {khz} {bitdepth}bit {abr})
Asset A
David Bowie/Diamond Dogs (HD Remastered) (2016)/CD null/01 - Future Legend (Remaster) - (FLAC 2ch 96.0 kHz 24bit 2.8 Mbps)
Asset B
Frank Zappa/Waka Wazoo (2022)/CD null/01 - Big Swifty (Alternate Mix) - (FLAC 2ch 96.0 kHz 24bit 3.1 Mbps)
Test 2
Change the syntax by changing 'part/position' to 'part'

Code: Select all

{artist}/{album} ({y})/{'/CD '+media.'part'}/{pi.pad(2)} - {t} - ({aco} {af} {khz} {bitdepth}bit {abr})
Asset A
David Bowie/Diamond Dogs (HD Remastered) (2016)/CD null/01 - Future Legend (Remaster) - (FLAC 2ch 96.0 kHz 24bit 2.8 Mbps)
Asset B
Frank Zappa/Waka Wazoo (2022)/CD 2/01 - Big Swifty (Alternate Mix) - (FLAC 2ch 96.0 kHz 24bit 3.1 Mbps)
Test2 is closer to what I want, but as seen in Test 2 Asset A rather than generating a path without the 'CD' subfolder, I still get CD null when actually I just want:
David Bowie/Diamond Dogs (HD Remastered) (2016)/01 - Future Legend (Remaster) - (FLAC 2ch 96.0 kHz 24bit 2.8 Mbps)
Aside from this, just want to say thanks for such a brilliant tool. I've been paying for and using Filebot for almost three years now - I can't imagine working with my NAS/Plex media collections without it :)
User avatar
rednoah
The Source
Posts: 23504
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Put music in subfolder if album consists of multiple discs

Post by rednoah »

:idea: If you have already confirmed how media.part works, i.e. yielding null or 2, perhaps null behaviour has changed over the years, then you can have your code check for that and do different things depending on the values at hand:
viewtopic.php?t=4191

e.g. add /CD 1/ to the file path, or not:

Code: Select all

{ if (media.part) "/CD ${media.part}/" }
:idea: Please read the FAQ and How to Request Help.
Post Reply