Search and Replace v1.21 [Script]

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Search and Replace v1.21 [Script]

Post by DiddeLeeDoo »

This is a developing version of a simple 'Search and Replace' script.

Image

The script is case sensitive, so it can be used for Case changes.

The 'Remove '(Parentheses Text)' option take out the parentheses and their content.

The Search and Replace can be found in the Edit Menu after installation. ShortCut key is Ctrl+Shift+H.

It can be handy to use the Ctrl F command to find certain things you want modify before running the script.

Changelog:
1.00 - 1.10 : Added a whole lot of more fields
1.10 - 1.11 : Made an empty 'Search for' and none empty 'Replace with' act as a 'Set value if field is empty' function.
1.11 - 1:12 : Clean-up of code.
1.12 - 1.13 : Search to Clear correction.
1.13 - 1.14 : Menu item moved to the Edit menu, with Ctrl+Shift+H shortcut.
1.14 - 1.15 : Another clean-up, plus fix for non-skinned MediaMonkey
1.15 - 1.20 : Added ability to set values by using * in the Search field.
1.20 - 1.20b-e: Various fixes on a new model
1.20 - 1.21: Made it update only those songs who changed.

Please be aware that this script is 'work in progress' and is not fully tested. Use it to have a play with for now..

Code: Select all

Got time to test it today, and the script is not good at all, 'didn't fly' back to the work shop
Last edited by DiddeLeeDoo on Mon Mar 05, 2007 4:25 am, edited 30 times in total.
Image
RandallSG
Posts: 35
Joined: Wed Jun 21, 2006 8:44 am

Post by RandallSG »

I would love this script.

I would encourage you to consider adding both Album, Album Artist, and Genre in your next version. I end up changing items such as "R & B" to "R&B".

The ability to use masks would also be much appreciated. For example, I collect the Whitburn Billboard singles, and define album to include the Year, so the ability to insert something like "Whitburn Billboard Hot 100 - <Year>" would be very useful.

Also, while I have not yet tried the script, I hope that the script acts upon the current selection.

Thanks for the addition!
MCSmarties
Posts: 251
Joined: Tue Dec 06, 2005 8:01 pm

Post by MCSmarties »

What a great initiative, DiddeLeeDoo!

However, I would guess that by far the most useful fields for such a script are the "Comments" and "Lyrics" field.

Is there a way to call up this script WHILE editing these fields?
I am thinking of something like the search & replace function in notepad or MS word...

CTRL+R while editing one of these "long" fields brings up your script,
then you can replace characters or entire words.
Going even further, being able to use wildcards and special functions like in word would be useful.

Finally, the best would be a possibility to define macros!
ex: capitalize the first character of each line, replace ` by ', double lines by single lines...

Just a few ideas to (hopefully) arouse your curiosity!
DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo »

Glad you find it useful. I got tired of doing manual edit of some SongTitle values I wanted to change.

There's build in some Genre 'Magic' in MediaMonkey already.

Library > Genres
Then see all those
R & B
RB
R& B
R&B

genres there. What you do is to change the first one to R&B and you'll see, like magic that all the songs get changed and the R & B will join the R&B ones. It's quite fun to do when you get started.

Thank you for suggesting additions though, I'll look into it during the week...
Image
DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo »

@MCSmarties

Thank you for your feedback. All of those things you mention is possible, guess you'll see something like that too during the week.

Forgot about Lyrics, that's a good idea too. All those fields that's not that easy to do 'bulk' edit off..
Image
Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Post by Bex »

Hi, W. Kyle White wrote this script:
http://www.mediamonkey.com/forum/viewtopic.php?t=5160

Which has some smart functions:
- ReplaceStringInField
- ModifyField

But his script isn't the most beautiful one i've seen and it doesnt update the tags. But it's pretty smart and could perhaps add inspiration to this script.

/Bex
Advanced Duplicate Find & Fix Find More From Same - Custom Search. | Transfer PlayStat & Copy-Paste Tags/AlbumArt between any tracks.
Tagging Inconsistencies Do you think you have your tags in order? Think again...
Play History & Stats Node Like having your Last-FM account stored locally, but more advanced.
Case & Leading Zero Fixer Works on filenames too!

All My Scripts
DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo »

Moved the 1.1x code to the top...
Last edited by DiddeLeeDoo on Tue Sep 12, 2006 7:02 am, edited 1 time in total.
Image
DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo »

Thinking about it, I guess all those fields can be kept, but a preview of what's will be happening would make sense to ensure good results.....
Image
DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo »

Running a bit of testing when I get a moment. Updated to 1.13 at the moment.. Going through my collection and do various changes of this and that... See that more advanced functions could be handy, like expressions for example.
Image
DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo »

V1.20 - Added ability to set values by using * in the Search field
Image
salamat
Posts: 23
Joined: Sun Aug 20, 2006 3:32 am
Location: Philippines

Post by salamat »

This seems to be a great script DiddeLeeDoo, something I miss in MM...But where can I download it???????? Cannot see it anywhere here in this topic for download.....Or, do I overlooking something???

BTW, thank you so much for all the improvements you are doing for the use of MM....You are The Man!!!!!!
DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo »

I'm just bitten by the 'scripting bug' and it's fun to be able to 'think it - do it' :)

I took this script out due to I found it took far too much CPU power when doing thousands of files. Used it to do some thousand files here, and it brought my computer to it's knees.

Played around with it yesterday, and found a way to avoid the heavy CPU load, and will post an updated version here as soon as time allow.

Will also go trough possible fields and all that...

Have a bit much 'real work' to do these days, so updates to scripts here are not happening as fast as I would like.
Image
salamat
Posts: 23
Joined: Sun Aug 20, 2006 3:32 am
Location: Philippines

Post by salamat »

OK, I understand.........So I'll just wait patiently.....you just keep up your good work........when you have the time.....
salamat
Posts: 23
Joined: Sun Aug 20, 2006 3:32 am
Location: Philippines

Post by salamat »

BTW, it would be nice if it had the same function as in word for windows, this ? or * to replace any kind of letters with a space, e.g.; search for *_*, replace with
* *......., to fix all this annoing the_night_I_was_alone type of things......
DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo »

I agree with that, and that is something that can be done. I just dropped in that version in the 'works' at the moment, in the first post.

Haven't had much time to test it. The code have one of those functions at the moment.

If you use * in the Find what, you basically set values with the Replace with value.

Leave the Find what blank, and it will find fields that are blank, and set values for those only.

More stuff will be added too, and I hoping for some time next week do that, and also add an 'undo' function, so you can have a play without being too afraid of stuffing it up.
Image
Post Reply