Skip to main content


If you are using a Hotmail or Outlook email address, please change it now, as Microsoft is rejecting all email from our service outright.
Topic: Search and replace inside lyrics (Read 365 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Search and replace inside lyrics


Some time ago I've made a mistake when tagging my files and I've been dragging that mistake with me for such a long time that I even forgot what exactly the mistake was.

Basically in the case of some songs (probably many) I managed to insert at the beginning of the lyrics field (%lyrics%,%unsynced lyrics% of %unsyncedlyrics%, depending on the song) something like this:

Code: [Select]
');var c=function(){cf.showAsyncAd(opts)};if(;else{cf_async=!0;var r=document.createElement("script"),s=document.getElementsByTagName("script")[0];r.async=!0;r.src="//";r.readyState?r.onreadystatechange=function(){if("loaded"==r.readyState||"complete"==r.readyState)r.onreadystatechange=null,c()}:r.onload=c;s.parentNode.insertBefore(r,s)};}})();

I've been squeezing my brains out trying to devise some way to correct it, but I still cannot find something useful.

Basically the idea would be to search inside %lyrics%,%unsynced lyrics% of %unsyncedlyrics% fields for (); and then cut everything before this three caracters, including these 3 characters. I'm very confident that there aren't any songs containing this specific set of characters in their lyrics.

Any ideas?


Re: Search and replace inside lyrics

Reply #1
Code: [Select]
%lyrics% HAS ();

Highlight all the files and create a new playlist with them. Double check there aren't many false positives.

Right-click on them and choose Properties. Tools > Automatically fill values.

Set Source to %lyrics%. Set Pattern to something like:
Code: [Select]
%% (); %lyrics%

This should net you the original column and the adjusted one to the right, with the unnecessary parts cut.

Double check this is what you want, then press OK and press Apply.

You could also write to %lyrics_test% or %temp% to the Pattern field (or whatever name you want to use) to see what the operation results in without touching your lyrics tags directly. You can delete the temporary tags later.

Repeat for unsynced lyrics.

Re: Search and replace inside lyrics

Reply #2
Hi Daeron,
Thanks for the suggestion!
Sadly it doesn't seem to work with multiline fields. Or at least, after half an hour of trying, that's what I believe. Could you please double-check my finding?

PS:I've read this wiki article countless times.

Re: Search and replace inside lyrics

Reply #3
Interesting. The initial library search really doesn't seem to work, not even as something like:
Code: [Select]
"$strstr(%lyrics%,abc)" GREATER 0

So I guess you could just filter via this, which will simply return all tracks that contain lyrics:
Code: [Select]
%lyrics% PRESENT

Then you can run the same Pattern as in my original post. If everything works right it should still strip the problematic files and leave the regular ones untouched.

Make sure to do a couple test runs on some dummy files to check it actually does what you want.

Re: Search and replace inside lyrics

Reply #4
It simply refuses to search in multi row fields.
I'll have to investigate this.
Thanks for the help!


Re: Search and replace inside lyrics

Reply #5
It simply refuses to search in multi row fields.
I'll have to investigate this.
I may have a solution, as long as you can filter a playlist view to only contain tracks having lyrics, then the next step (searching in multiline text) can be done in MP3tag by selecting all of the tracks and then drag/drop them on a MP3tag window.
In MP3tag make sure the Filter is present at the bottom (View > Filter or F3) and just type in the same query Daeron provided.
To verify the remaining visible tracks have indeed this string at the beginning you can add the lyrics/unsyncedlyrics field(s) to the tag panel on the left and just check each file quickly by scrolling through them with arrow-down.

Once you're sure all of them match your requirement, select Actions > Actions (Quick) from the main menu and using the option "Replace with regular expression" should be able to do what you want (do try this on one file to be sure it works, you could even just take a file without lyrics and add that string to test with so you don't accidentally destroy an existing lyric). Also make sure to copy the regex first to a notepad or something as you'll need to repeat those steps once on all of the selected files after you verified it takes out what you need.

Also be aware that Foobar2000 calls the field %lyrics% but MP3Tag shows it as %unsyncedlyrics% in the Extended tag view

Re: Search and replace inside lyrics

Reply #6
Thanks guys! In the end I've got a bit of help here and it worked! There were onyl 207 files corrupted.
Regarding the actual renaming, I used the Split function inside Masstagger with the whole unwanted text as the splitter (at least I was lucky that the unwanted text was the same in every file).

SimplePortal 1.0.0 RC1 © 2008-2020