Need help with simple scripting - putting disc number in front of track number

scripting
Tags: #<Tag:0x00007f2a00d7c2c0>

#1

Hi there,

Can someone please help me with this simple scripting issue? I use this really simple script:

$if2(%albumartist%,%artist%)/%album%/$if($gt(%totaldiscs%,2),%discnumber%-,)$num(%tracknumber%,2) - %artist% - %title%

It produces the following results which are fine for me:
03 - Depeche Mode - Strangelove.mp3
or
01 - Bob Marley with Erykah Badu - No More Trouble.mp3

My problem is with multiple discs. Right now it starts each disc from 01 and without the disc number, like this:

01 - The Doors - Break On Through.mp3 - this is the first track from the first disc,
01 - The Doors - Hello, I Love You.mp3 - this is the first track from the second disc which is in fact the 13th track.

How do I change my script to rename the multidisc tracks as following (with the leading zero):

01-01 - The Doors - Break On Through.mp3
02-13 - The Doors - Hello, I Love You.mp3

I really do not want something complicated only a simple addition to my script but I am pretty bad with that.

Thanks for any help.


#2

This script already puts in the disc number, but only if there are more than 2 discs because of $gt(%totaldiscs%,2)! Two options:

  1. If you want to have the disc number only if there is more than 1 disc, use:

    $if2(%albumartist%,%artist%)/%album%/$if($gt(%totaldiscs%,1),%discnumber%-,)$num(%tracknumber%,2) - %artist% - %title%
    
  2. If you always want to have the disc number regardless of number of discs (even for single disc release) it is even easier:

    $if2(%albumartist%,%artist%)/%album%/%discnumber%-$num(%tracknumber%,2) - %artist% - %title%
    

#3

If I’m understanding this correctly, you want the track numbers to continue across the disks. In your example above, Hello, I Love You is the first song on the second disk, right? In that case you want to use the variable %_absolutetracknumber% instead of %tracknumber%.

Here’s a list of tags and variables in Picard:
https://picard.musicbrainz.org/docs/tags/


#4

Thanks outsidecontext. The first case is exactly what I want. Only one thing, no leading zero. So now it looks like this:

2-13 - The Doors - Hello, I Love You.mp3

How to make it look like this:

02-13 - The Doors - Hello, I Love You.mp3


#5

Thanks Billy_Yank, I am fine with the track numbers starting from #1 on each disc, my problem is only the disc number with leading zeroes. In the meantime I solved it by placing 0 in front of %discnumber% but I am not sure it is the correct way:

$if2(%albumartist%,%artist%)/%album%/$if($gt(%totaldiscs%,1),0%discnumber%-,)$num(%tracknumber%,2) - %artist% - %title%


#6

Use $num(%discnumber%,2) instead of just %discnumber%.


#7

Thanks a lot all of you. Now it looks like this and is doing exactly what I want. I hope there are no hidden problems so just for check:

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