Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Help with padding values of comment field (Read 1726 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Help with padding values of comment field

Here's some examples of what's in the comment field:
8A/4A
4A
9B
4A
12A

And this is the result I was after:
08A/04A
04A
09B
04A
12A

In mp3tag with the regexp function I can do something like this:
Code: [Select]
$regexp(%comment%,'(\b[1-9]{1}[A|B])','0$1')

How can I do something like this in fb2k in short hand code? Notice I only want to pad to the value of 2 so the 12A would not get affected in the example above.

Thanks.

This is what I have currently which is doesn't work so well for 11A and 11B and I was hoping to learn how to do this a little bit more shorthand if that's possible without the $regexp function that mp3tag has.
Code: [Select]
$replace($replace(%comment%,1A,01A,2A,02A,3A,03A,4A,04A,5A,05A,6A,06A,7A,07A,8A,08A,9A,09A,1B,01B,2B,02B,3B,03B,4B,04B,5B,05B,6B,06B,7B,07B,8B,08B,9B,09B),00,0)


Re: Help with padding values of comment field

Reply #1
If you can use Masstagger, perform these two steps: (1) split value by separator "/", (2) use $pad_right(comment,3,0) and concatenate the split values together again. However, it is not short hand.

Format value from other fields:
Code: [Select]
$if(%comment%,$pad_right($meta(comment,0),3,0),)$ifgreater($meta_num(comment),1,/$pad_right($meta(comment,1),3,0),)

Re: Help with padding values of comment field

Reply #2
Well, if I understood correctly...
Code: [Select]
$ifgreater($strchr(%comment%,/),0,$iflonger($substr(%comment%,1,$strchr(%comment%,/)),3,$substr(%comment%,1,$strchr(%comment%,/)),0$substr(%comment%,1,$strchr(%comment%,/)))$iflonger($substr(%comment%,$strchr(%comment%,/),$len(%comment%)),3,$substr(%comment%,$strchr(%comment%,/),$len(%comment%)),0$substr(%comment%,$add($strchr(%comment%,/),1),$len(%comment%))),$iflonger(%comment%,2,%comment%,0%comment%))

Re: Help with padding values of comment field

Reply #3
Thanks guys for your help. The splitting and formatting then joining wasn't ideal. I was hoping for something in one format action.

I've settled on this (which is verbose, in a way):
Code: [Select]
$replace($replace($replace(%comment%,1A,01A,2A,02A,3A,03A,4A,04A,5A,05A,6A,06A,7A,07A,8A,08A,9A,09A,1B,01B,2B,02B,3B,03B,4B,04B,5B,05B,6B,06B,7B,07B,8B,08B,9B,09B),00,0),101,11)

The 00,0 will remove double 0s' and the 101,11 replace will fix the issue I was referring to earlier.

I should have mentioned that sometimes the comment field my be like this also (Apologies for not giving this example):
4A - 6 - R6
5A - 6 - R7
7A - 6 - R6
9B - 6 - R5
4A - 3 - R6
11A - 2 - R3
12A - 5 - R6
08A/04A- 6 - R2

It'll be an good day when FB has a regular expression function. It's perfect apart from that. I've already made a suggestion here in the suggestion section in the hopes that it'll get added.



Re: Help with padding values of comment field

Reply #4
Is there a particular reason to use fb2k for such tagging purposes when mp3tag does it?

I find myself using mp3tag all the more often after fb2k started destroying <ALBUM ARTIST SORT> for lossy files :-(

 

Re: Help with padding values of comment field

Reply #5
Is there a particular reason to use fb2k for such tagging purposes when mp3tag does it?

I find myself using mp3tag all the more often after fb2k started destroying <ALBUM ARTIST SORT> for lossy files :-(
I don't really use Mp3tag that much for running actions or manipulating tags as much as I used too, plus it's just quicker in the same program.

Mainly I use Mp3tag for the Web Source Scripts if when using fb2ks' Discogs plugin, there's no Discogs result. But most electronic music is done by my beatport script.