kwanbis
Sep 29 2007, 15:02
Hi, i think i found a masstager bug, on 0.9.4.4.
If you run FORMAT TRACKNUMBER $trim(%tracknumber%,X), it trims all fine, BUT the tracknumbers where X matches the last value, get trimed to the X-1 leftmost chars.
For example, if we start with tracknumbers:
101
102
103
...
111
112
113
$trim(%tracknumber%,2)
101
10
103
...
111
11
113
$trim(%tracknumber%,3)
101
102
10
...
111
112
11
etc.
Same for two chars tracknumbers.
Frank Bicking
Sep 29 2007, 15:25
First of all, this is not related to the Masstagger but to title formatting in general.
There is no documented second parameter for $trim() in neither the included titleformat_help.html nor the reference in the wiki. It looks like you have stumbled across an undocumented feature, and assumed it to behave in some way. Let's see what it actually does:
$trim(s) removes leading and trailing spaces from the string s.
$trim(s,x) removes leading and trailing characters matching character x from string s.
$trim(ba,a) = b
$trim(aab,a) = b
$trim(abba,a) = bb
etc.
Now what exactly did you intend to achieve with that parameter?
If you just want to remove unnecessary spaces, use $trim(%tracknumber%).
If you want to cut your tracknumbers down to a specific length, use $cut(%tracknumber%,2), where 2 is the length.
If you want to pad tracknumbers with leading zeros, use $num(%tracknumber%,len).
kwanbis
Sep 29 2007, 15:35
I have been using some scripts since 0.7 or less. One of it is:
$trim($num(%tracknumber%,2))
That would make my tracknumbers all 0 paded up to 2 values.
Somehow, i edited the code to look like $trim(%tracknumber%,2), using the ,2 parameter that was from $num, into $trim.
So, you are right, it could be a undocumented feature, but if it is, it has a bug anyway.
Now re-reading docs, i see there is $cut, for what i want:
$cut(%tracknumber%,2), and it works ok.
Now, it looks like maybe the issue is specific enough, to take a look at the code, maybe it could affect another scripts?
Frank Bicking
Sep 29 2007, 15:38
QUOTE
So, you are right, it could be a undocumented feature, but if it is, it has a bug anyway.
And which bug would that be?
kwanbis
Sep 29 2007, 15:45
QUOTE(Frank Bicking @ Sep 29 2007, 21:38)

QUOTE
So, you are right, it could be a undocumented feature, but if it is, it has a bug anyway.
And which bug would that be?
If the undocumented parameter makes $trim(tag, X) behave like $cut(tag, X), it works the same on ALL cases, but where X = last digit of the number (haven't tested it with other tags besides tracknumber)
Example1:
$cut("101", 3) -> 101
$cut("102", 3) -> 102
$cut("103", 3) -> 103
$cut("104", 3) -> 104
$trim("101", 3) -> 101
$trim("102", 3) -> 102
$trim("103", 3) -> 10$trim("104", 3) -> 104
It's obvious that the second parameter is affecting the result, but not on the undocumentedly-expected way.
It's like where the last digit matches the number of the undocument second parameter, it does a $cut(tag, number-1)
Frank Bicking
Sep 29 2007, 16:01
QUOTE
If the undocumented parameter makes $trim(tag, X) behave like $cut(tag, X)
Nobody said it would.
Sorry, but you have obviously skipped the description and the examples in my first answer.
The second parameter does not denote a length, but a specific character.
QUOTE
It's like where the last digit matches the number of the undocument second parameter, it does a $cut(tag, number-1)
Exactly. And this is what it's supposed to do. See my other examples.
Please stop insisting on this being a bug, because it isn't.
kwanbis
Oct 1 2007, 13:21
QUOTE(Frank Bicking @ Sep 29 2007, 22:01)

Sorry, but you have obviously skipped the description and the examples in my first answer.
The second parameter does not denote a length, but a specific character.
Sorry, yes i overlooked that part.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.