Filter for COMMENT starts with 0 (the number)

I am trying to make a filter for COMMENT starts with 0 (the number). I have numeric keys in my Comments field and need to remove all the 0s that I added before the key, before I can rescan after updating my other scanning/tagging software (Mixed In Key).

This is filter is close "%comment% HAS 0" but I want it to only return tracks that the comment starts with 0.

For instance, I want to find tracks that look like this 01A or 09B. But not to return tracks that are 10A.

I am using this filter with "$cutLeft(%COMMENT%,1)" to cut the first digit off the comment field. This works perfectly, as long as I can get the filter right.

Thanks for the help!

"%comment%" MATCHES "^0"

EDIT: I recently updated MIK and rescanned my entire library and deleted the old keys from the INITIALKEY tag and COMMENT as their new algorithm is getting even more accurate with 5% more accuracy between v5 and v6.

Here's a post on my beatport scripts thread in relation to that: beatport.com scripts by stevehero (search & direct) - jaimz mod

OR test for $left being 0 using $ifgreater() THEN remove the leading 0, rather than "cutting" the leftmost character from the string value regardless.

Thank you, worked perfect! Yea, just upgraded to MIK6 also. Unfortunately I found all this after I finished the project. So I am working on commands I need for the next time they upgrade the algorithm and I need to re analyze everything. A little miffed at their design flexibility, but it is hard to knock that fact that they kill the competition in accuracy.

Chris - sounds great and if I was not so brand new to this tool (day 1 for me) I probably would have worked toward something like that. I will have to do some tweaking as I could not really get that expression to work, but that would be the ideal expression to have for sure! I hate to ask for more exact phrasing, but I could use a little more help with that one if you don't mind.

Thanks for the super speedy help guys! Already loving this software, deffinately going to donate now that I know what it can do.

I know this is off-topic but: With the new version 6 it updates your tags: It's pretty clever. So I have my tags like so:
9A - 8 - R5

9A is Key
8 is Energy
And I manually add ' - R5' as a rating in the COMMENT tag.

If for some strange reason the 9A changed to 10A and I add the song to MIK it will only update the 10A to become 9A again without affecting my custom text at the end. I've emailed the developers about being able to pad the digits by 2 and they said they are already looking into it for the next release. You can test this on a couple of tracks before you go deleting tags like I did. Although I just wanted a clean start. Multi-thread processing is an amazing addition.

Here's my settings if that's any help.



Thanks, actually had MIK 5 for 2 years. I hate the fields it writes to but finally gave into making it work their way.

I like to keep the data in separate fields so I can sort by any one of them independently in VDJ. I also don't use ratings because that changes as tracks get older. I just make all kinds of pick lists.

My Key is set to go into Comments (wish it could do Composer)
Energy is in grouping

I just moved (before I got this tool) all my comments to the Composer field (yes manually). That way keys would now stay where MIK puts them, instead of moving them to composer like I have been doing for years. What a PITA...

The move to MIK6 I knew would need a rescan so I figure it was time to give into their work flow and give up on them helping me/us. Hoped in the end to have better accuracy with less fussing around.

I also found a way to Bulk Rename .m4v (iTunes Music Video) files so you can scan those too if you are interested.

Filter:

"$left(%COMMENT%,1)" IS 0

... or ...

"$left(%COMMENT%,1)" IS "0"

... or ...

"%COMMENT%" MATCHES "^0"

... or ...

COMMENT MATCHES "^0"

To remove the leftmost character resp. any leading zero character use an action "Format value" on the tag-field COMMENT with format string ...

$cutLeft(%COMMENT%,1)

... or ...

$trimLeft(%COMMENT%,'0')

DD.20140214.1017.CET

All Awesome commands! Thank you, works perfectly!

I know I dug up my old thread but I want to try and make this task easier. The following 2 steps works great so far.

Currently, If I filter by this: NOT %comment% MATCHES ^\d\d

I want to do this to the remaining songs: 0%comment%

Currently I do them in two steps, but I figure there has to be a way to combine them. I tried IF statements but it adds the 0 anyway. I am guessing Boolean is not the right way to go.

This is what I used: $if(%comment% MATCHES ^\d\d,0%comment%,)

To sum up the end goal, I just want to select all my tracks and if a field starts with 2 digits like 11A or 02B, then I want to leave it alone. If it starts with only 1 digit, I want to add a "0" in front (like my "02B" example).

Thanks for any help you can give!

I guess that the syntax is not correct.
you have to use $if($eql(...

But what about the brute force approach? you simply add a zero to any comment and then remove all double zeros with just a single one?

Thanks, will try the above. As far as the second approach may not be good for two reasons.

  1. I run Microsoft Sync Toy which checks for every file that changes and backs up only the newly changed files. So it would re copy everything with every run of the action. I try to avoid this as I am delaying a rescan right now with Mixed in key. Which is an auto tagging software for Key and BPM.

  2. Which brings me to, how would I differentiate the songs that were 2 digits already. Like 10A, 11A, 12A? Those would not be two 0's

Mixed In Key just came out with a new version, so I will be doing a rescan soon. Just planning my MP3Tag filters to help speed up the process when I do that rescan which will be very soon.

I was looking at this feature for everyday scans. Seems as though I leave the 2 digit filter on in MP3Tag all the time. Turning on and off is not ideal going lower right to find the filter or highlight and delete to go off. Tying for less steps if possible, works too well and I really should not be messing with it :slight_smile:

Not necessarily, you can set Mp3tag to preserve the current datetime stamp of a file.

DD.20150214.2111.CET

Tried "$if($eql(%comment% MATCHES ^\d\d),0%comment%,)" and that did not work. Still added an extra 0 no matter what.

Of a changed file? Hmm, sounds interesting. Not sure how Sync Toy determines changes. I assumed it looked at file data ETC.

Filter: COMMENT MATCHES "\A\d\D.*"

Action: Format value
Field: COMMENT
Formatstring: $regexp(%COMMENT%,'\A\d\D.*','0$0')

... or ...
Action: Format value
Field: COMMENT
Formatstring: $num(%COMMENT%,2)$trimLeft(%COMMENT%,'0123456789')

DD.20150214.2158.CET

This is still invalid syntax. The "MATCHES" is only a valid keyword for filters and has to be set between a field and the expression.
If you want to perform an action (probalby "Format value") you have enter a valid expression.
See http://help.mp3tag.de/main_scripting.html
The $if and $eql functions compare string constants, so you have to generate such a constant first before you can compare them.

Got a little distracted (sorry for delay), but this first one is great. Thank you both for all the help!