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: How to find tracks with selected tags starting or ending with whitespa (Read 2205 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

How to find tracks with selected tags starting or ending with whitespa

HI

Please help me to build search pattern for finding all tracks in database having title, album or artist fields starting or ending with any whitespace character.
I can't see any expression for substring capturing in search syntax, thanks.

How to find tracks with selected tags starting or ending with whitespa

Reply #1
in the properties dialog, right click the field(s) and select clean up.

or if you just want to find the tracks:

Code: [Select]
"$ifgreater($len(%album%),$len($trim(%album%)),1,0)" IS 1

 

How to find tracks with selected tags starting or ending with whitespa

Reply #2
This is still undocumented, but IS supports * and ? placeholders.
In combination with quotation marks for spaces, you could use:

Code: [Select]
title IS " *" OR title IS "* "

Or, for double spaces within the title:

Code: [Select]
title IS *  *

As already brought up, "clean up" fixes all of the above.

How to find tracks with selected tags starting or ending with whitespa

Reply #3
Thanks, I didnot know about the asteriks!

How to find tracks with selected tags starting or ending with whitespa

Reply #4
I didn't even know about the "clean up" command; this is very useful... I don't have to be bothered with finding random spaces before or after tags now!

How to find tracks with selected tags starting or ending with whitespa

Reply #5
Alternatively with titleformatting:

Search for leading space:
Code: [Select]
$strstr($left(%title%,1),' '))

Search for trailing space:
Code: [Select]
$strstr($right(%title%,1),' '))

Search for double space:
Code: [Select]
$strstr(%title%,'  ')

Trim trailing & leading spaces (use with Properties/Tools/Automatically fill values):
Code: [Select]
$trim(%title%)

How to find tracks with selected tags starting or ending with whitespa

Reply #6
Is there a way to make the search query look at all tags, not just a certain one, like title or album?

How to find tracks with selected tags starting or ending with whitespa

Reply #7
the easiest thing to do is to search for and select all files>right click>properties>highlight all fields and use clean up. foobar will only update files that actually need fixing.

How to find tracks with selected tags starting or ending with whitespa

Reply #8
That is true; but if possible I'd like to see what is out there via a query first.  The query provides a nice reference list for how many files need renaming or tag fixing in other places, e.g., iTunes.

How to find tracks with selected tags starting or ending with whitespa

Reply #9
i've made a quick and dirty WSH panel mod script that can do this. first install this component and add a panel to your layout:

https://code.google.com/p/foo-wsh-panel-mod/downloads/list

replace the code inside the panel with this...

https://dl.dropboxusercontent.com/u/2280132.../whitespace.txt

ignore the fact it's just a plain white panel. now add all your music to a single playlist. double click the panel to run - it may take some time depending on collection size.

when done, a popup box will appear if everything is ok. if not, problematic files will be sent to a new playlist.

edit: it would be best to run this with foobar not playing. a track change while it's running might interfere.

How to find tracks with selected tags starting or ending with whitespa

Reply #10
I'm using Columns UI - will that work?    Sorry I'm not proficient in WSH panel mod scripts yet.

How to find tracks with selected tags starting or ending with whitespa

Reply #11
yes, just add it on the layout tab in the preferences like you would any other panel. you can easily remove it when you're done.

How to find tracks with selected tags starting or ending with whitespa

Reply #12
Hey, that worked!  You're awesome, thanks!  I was concerned that too many UNSYNCED LYRICS tags with leading and trailing whitespace in them would get picked up and muddy up the results, but it doesn't appear to be recognizing that tag.  Does that maybe have something to do with it not being seen because of its LargeFieldsConfig classification or something?

How to find tracks with selected tags starting or ending with whitespa

Reply #13
Does that maybe have something to do with it not being seen because of its LargeFieldsConfig classification or something?


yes, i did a quick test by adding a large chunk of text to a file in that tag.

i then replaced the check_tag_length function in the code with this....

Code: [Select]
function check_tag_length(t, h) {
    var s = fb.TitleFormat("%" + t + "%").EvalWithMetadb(h);
    if (t.toUpperCase() == "UNSYNCED LYRICS") {
        fb.trace(h.Path);
        fb.trace(t + " original length " + s.length);
        fb.trace(t + " trimmed length " + s.trim().length);
    }
    return s.length > s.trim().length;
}


this reports to the foobar console and this is what i saw...

Code: [Select]
D:\Music\Mixes\Dave Flitcroft - 3 Hour Mix.mp3 
unsynced lyrics original length 1
unsynced lyrics trimmed length 1


edit: after removing UNSYNCED LYRICS from the spam list and editing defaultMetaMax to a stupidly high value, it works.

Code: [Select]
D:\Music\Mixes\Dave Flitcroft - 3 Hour Mix.mp3 
unsynced lyrics original length 6845
unsynced lyrics trimmed length 6834