Help - Search - Members - Calendar
Full Version: Scripting help needed
Hydrogenaudio Forums > Hosted Forums > foobar2000 > General - (fb2k)
neothe0ne
To explain, my Zen Vision:M doesn't support discnumbers. Since I don't want my navigation bloated with 4 "albums" for a 4-CD album by sticking (Disc x) at the end of the album tag, I've stuck the discnumber in front of the actual tracknumber. For example, Disc 1 track 20 becomes track 120.


Since foobar2000 has the nasty feature of turning tracknumbers from 128-156 and 384-412 into negative numbers starting at -128 and counting up to -100, I've tried to fix my tracknumber column to negate that fact.

What I want, is:
if -99 > track and discnumber = 1, then add 256 to track, else
if -99 > track and discnumber = 3, then add 512 to track, else
if -99 > track and discnumber = 4, then add 512 to track, else
%tracknumber%


I've only ever been able to get one script to work though:
$if($greater(-99,%tracknumber%),$add(%tracknumber%,256),%tracknumber%)

^this, unfortunately, doesn't take discnumber into account, so the tracknumbers are still inaccurate if they rise to 384 or higher. I've tried to stick $and($if...,$if...) into there, but it never works.

Can anyone help me with this display script, or is it even possible to get a conditional statement to do what I want?
foosion
QUOTE(neothe0ne @ Jul 26 2007, 21:28) *
Since foobar2000 has the nasty feature of turning tracknumbers from 128-156 and 384-412 into negative numbers starting at -128 and counting up to -100, ...

That is actually a limitation of ID3v1.1 which uses a single byte to store the track number. Avoid ID3v1.1 (if you can), and you should be set.

The following should do the trick, but is untested:
CODE
$ifgreater(0,%tracknumber%,$add(%tracknumber%,$mul(256,%discnumber%)),%tracknumber%)

Just curious, but you haven't mentioned track numbers from 257 to 383. I would expect that they are mapped to the range from 1 to 127.
neothe0ne
QUOTE(foosion @ Jul 26 2007, 16:18) *

QUOTE(neothe0ne @ Jul 26 2007, 21:28) *
Since foobar2000 has the nasty feature of turning tracknumbers from 128-156 and 384-412 into negative numbers starting at -128 and counting up to -100, ...

That is actually a limitation of ID3v1.1 which uses a single byte to store the track number. Avoid ID3v1.1 (if you can), and you should be set.

The following should do the trick, but is untested:
CODE
$ifgreater(0,%tracknumber%,$add(%tracknumber%,$mul(256,%discnumber%)),%tracknumber%)

Just curious, but you haven't mentioned track numbers from 257 to 383. I would expect that they are mapped to the range from 1 to 127.


I know that it's been explained the negative tracknumbers is a bug due to ID3v1, but Mp3tag 2.38 handles the track numbers without going negative, as does Windows Media Player 11 and most importantly, my Creative Zen Vision:M.

Both ranges 128-156 and 384-412 turn into -128 to -100.

Also,
$ifgreater(0,%tracknumber%,$add(%tracknumber%,$mul(256,%discnumber%)),%tracknumber%)
that part in bold breaks the entire script. That is what I meant by sticking additional $() conditions into the $if; it completely breaks the script and it doesn't do anything. If I replace the bold with something else, then the script would work, but then I can't make the script do what I want it to.

Going by a multiple of disc number wouldn't work either, because at 384-412, the negative tracks of disc 3 and 4 both need to have 512 added to it; the problem doesn't affect disc 2 at all, where 512 would happen in that script.
foosion
QUOTE(neothe0ne @ Jul 26 2007, 22:25) *
I know that it's been explained the negative tracknumbers is a bug due to ID3v1, but Mp3tag 2.38 handles the track numbers without going negative, as does Windows Media Player 11 and most importantly, my Creative Zen Vision:M.

Both ranges 128-156 and 384-412 turn into -128 to -100.

foobar2000 merges information from different tag types, using character count to decide which value to use when there are two different values for the same tag. Since text fields in ID3v1 are length-limited, this usually chooses the non-truncated version from the ID3v2 tag. Well, with track number it's a little different, since ID3v1.1 stores that in binary. I guess that the other players you mentioned ignore the ID3v1.1 tag, if there is an ID3v2 tag, so the easiest solution is still to strip the ID3v1 tag from you files. (I'm too tired today to come up with a working titleformat script.)
neothe0ne
QUOTE(foosion @ Jul 26 2007, 16:39) *

I guess that the other players you mentioned ignore the ID3v1.1 tag, if there is an ID3v2 tag


Is there any chance then that an option can be added to foobar to choose what tags to read, like Mp3tag has? I know both Mp3tag and foobar2000 has options on what tags to write. I don't want to rewrite my tags to thousands of MP3s right now, especially since that would require me to resync my entire library over my current Zen's library to prevent any duplicate track headaches later down the road.
Lyx
Your MP3-player does not support it. If you abuse tagfields for stuff for which they arent meant, then dont expect the rest of the world to adapt, just because you dont want to accept that the only halfway sane solution is adding it to the albumname. Thoundsands of other fb2k users should not suffer from increased software-complexity (more options) just because of your individual usage-case.

As for why its different with FB2k: Other apps tend to give you full control over the Tag-types. FB2k *intentionally* doesnt do this. Its design is to make it so that the user no longer needs to care about tagtypes (as long as ID3v2, vorbiscomment, etc is used), so that the user can focus on the actual metadata, instead of on tags. Many features in fb2k are designed around this philosophy. ID3v1 support is just there for last-resort backwards-compatibility, not for really doing any advanced stuff with it. If you want to have control over tag-types, FB2k is the wrong application.

- Lyx
neothe0ne
QUOTE(Lyx @ Jul 26 2007, 18:06) *

Your MP3-player does not support it.

Does not support... what? And I've already said, I've tried making a display script for my tracknumber column, but no one has explained how to make a working conditional $if(...) statement that has other conditional/boolean statements inside it.

QUOTE(Lyx @ Jul 26 2007, 18:06) *

If you abuse tagfields for stuff for which they arent meant

That seems a little harsh; how do you know no one intended to have an album contain hundreds of tracks?

QUOTE(Lyx @ Jul 26 2007, 18:06) *

then dont expect the rest of the world to adapt, just because you dont want to accept that the only halfway sane solution is adding it to the albumname.

It may be a halfway sane solution for you, but it isn't for me. To each his own; that's why everyone organizes their mp3s differently.

QUOTE(Lyx @ Jul 26 2007, 18:06) *

Thoundsands of other fb2k users should not suffer from increased software-complexity (more options) just because of your individual usage-case.

Because foobar2000 isn't about options at all.
radio_cascara
i really don't see how stripping id3v1 from your songs could be more time-consuming and problematic than your quest to find formatting cludge or change the foobar code...
foosion
The following code is tested and should work. It uses the $select function to select the proper increment instead of an $if cascade.
CODE
$ifgreater(0,%tracknumber%,
$add(%tracknumber%,$select(%discnumber%,0,256,256,512)),
%tracknumber%)


By the way, the $and has to be placed inside the $if (a and b are comparisons or other boolean expressions):
  • Wrong: $and($if(a,...),$$if(b,...))
  • Right: $if($and(a,b),...)
neothe0ne
My bad; it does work. Thanks!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.