Having issue with multidisc script

I’ve been at this for days now and not making any progress. You can follow my discussion here:
https://www.reddit.com/r/musichoarder/comments/1g71h4s/need_some_help_with_a_picard_script/

I am trying to make a script that creates separate folders for each disc in a multi disc album, but only if there is more than 1 disc in that album.
From another discussion, I tried all of these and none seem to create a “CD” folder.
$if2(%albumartist%,%artist%)/$left(%originaldate%,4) - %album%/$if($gt(%totaldiscs%,1),CD %discnumber%/,)$num(%tracknumber%,2)-%artist%-%title%), ,_)

%artist%/%album% ($if(%date%,$left(%date%,4)))/$if($gt(%totaldiscs%,1),CD $num(%discnumber%,2))/$num(%tracknumber%,2)-%title%

%artist%/%album% ($if(%date%,$left(%date%,4)))/$if($gt(%totaldiscs%,1),CD $num(%discnumber%,2))/$num(%tracknumber%,2)-%title%

%artist%/%album% $if(%date%,($left(%date%,4)))/$if($gt($num(%totaldiscs%,$len(%totaldiscs%)),1),CD $num(%discnumber%,2))/$num(%tracknumber%,2)-%title%

The multi disc album I am testing on is definitely detected as multidiscs (3 in this case) as picard shows “DISCTOTAL 3” in the summary window when only loading that album into picard. If I remove the “$if($gt(%totaldiscs%,1),” or it’s variations in the above attempts, it will create a “CD” folder but I want it to only create a CD folder if there is more than one DISC, not for every album.
I am using picard v2.12.3. It seems like this should be simple and some version of the scripts above should work, but none are working correctly on both multi disc albums and single disc albums.
Any ideas anyone?

What file format are the files? It looks like your files have a custom tag that is literally called “DISCTOTAL”, but that’s not how Picard expects the total disc to be stored for that format.

You could add the tag called “totaldiscs” via the Add tag function in Picard, or you extend your script to also check for %DISCTOTAL%. Something like

$if($gt($if2(%totaldiscs%,%DISCTOTAL%),1),CD $num(%discnumber%,2))

The $if2(%totaldiscs%,%DISCTOTAL%) will use the totaldiscs variable (which is the default) if set or fall back to the DISCTOTAL variable. That way this should work with properly tagged files as well as files tagged with the custom tag.

1 Like

Thanks! It looks like your example works on both multi and single CD albums. What’s strange is that in the summary tab in picard, it shows both tags “DISCTOTAL” and “TOTALDISCS”.

I’d suspect your files have been converted from FLAC to MP3 (or maybe MP4) and the converter didn’t know how to handle the DISCTOTAL and TOTALDISCS tags from the FLAC and just copied them verbatim.

Those tags are used to indicate the total discs count in Vorbis tags. Picard stores both for player compatibility. In ID3 the total discs are stored differently (as part of the TPOS frame).

If you actually want to fix the files in Picard, add a new tag totaldiscs and remove the two other tags.

2 Likes