(Solved) Use discnumber in filename

Have been struggling with the code for some time now. Got stuck on the last part: i want to add the discnumber to be part of the filename (so, i can order two discs in one folder correctly).

Here’s my code:

$if($eq(%albumartist%,Various Artists),Various Artists/%album%/$if($gt(%totaldiscs%,1),Disc %discnumber%/)$num(%tracknumber%,2). $if2(%artist%,%albumartist%) - %title%,$left(%artist%,1)/$if2(%albumartist%,%artist%)/%album%/$if($gt(%totaldiscs%,1),Disc %discnumber%/)$num(%tracknumber%,2). $if2(%artist%,%albumartist%) - %title%) 

Works perfectly, except for discnumber. What is wrong here?

The relevant part is

$if($gt(%totaldiscs%,1),Disc %discnumber%/)

There are two things you probably are not aware of:

  1. This will not add the disc number to the file name but create a folder, e.g. “Disc 1” because if the / after the number. Remove the / to have the discnumber as part of the file name.
  2. This will only write the disc number if the release has more than one disc (if totaldiscs is greater 1). Remove the surrounding $if and leave only “Disc %discnumber%”. Not sure if you want the text "Disc " in front of the number, but since it is there I assume yes. Just remove that as well if you don’t need it.

Thanks m8! Changed it to:

$if($eq(%albumartist%,Various Artists),Various Artists/%album%/$if($gt(%totaldiscs%,1),$num(%discnumber%,2))-$num(%tracknumber%,2). $if2(%artist%,%albumartist%) - %title%,$left(%artist%,1)/$if2(%albumartist%,%artist%)/%album%/$if($gt(%totaldiscs%,1),$num(%discnumber%,2))-$num(%tracknumber%,2). $if2(%artist%,%albumartist%) - %title%)

Works perfect :slight_smile:

1 Like