RegExp Find & Replace 4.3 w/ 253 presets (2011-07-06) [MM2+]

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

Owyn
Posts: 2018
Joined: Fri Mar 21, 2008 10:55 am
Location: Canada
Contact:

Re: RegExp Find & Replace 3.6 w/ 101 presets (2009-07-02)[MM2+3]

Post by Owyn »

Here is one that has been bugging me for a while. I regularly need to get OrginalArtist from a title.
e.g.
Title: A Case Of You (Joni Mitchell cover)
Original Artist: Joni Mitchell

I have it working using 2 presets (plus a third to strip the info from title after I have checked results).
Preset110=Name: "Copy Title to OrigArtist", Description: "", Shortcut: "", Icon: "", Toolbar: False, FindWhat: "^.*", FindInto: "Original Artist", FindRegExp: True, WholeWord: False, ReplaceWith: "^.*", ReplaceFrom: "Title", ReplaceRegExp: True, ReplaceVBScr: False, MatchCase: False
Preset111=Name: "Pull origartist from title: Thirteen (Big Star cover)->Big Star", Description: "", Shortcut: "", Icon: "", Toolbar: False, FindWhat: "(^.*\()(.*)( cover\))", FindInto: "Original Artist", FindRegExp: True, WholeWord: False, ReplaceWith: "$2", ReplaceFrom: "Title", ReplaceRegExp: False, ReplaceVBScr: False, MatchCase: False
Try as I might I can not get these two presets combined into one operation without resorting to VBScript.

Any ideas?
Cogito cogito ergo cogito sum. (Ambrose Bierce)
I drink therefore I am. (Monty Python)
Vista 32bit Home Premium SP2 / MM3.2.1.1297 Gold / Last.Fm 1.0.2.22 / IE8
Dell Inspiron 530 (1.8 Core2 / 2GB)
Skin: Vitreous Blue
Scripts: Add/Remove Playstat|Advanced Duplicate Find & Fix|Album Art Tagger|Backup|Batch Art Finder|Calculate Cover Size|Case&Leading Zero Fixer|DB_Audit|DB_Clean|DB_Schema|Event Logger|Genre Finder|Lyricator|Magic Nodes|MM2VLC|Monkey Rok|MusicIP Tagger|PUID Generator|RegExp Find & Replace|Right Click for Scripts|Scriptreloader|SQL Viewer|Stats(Filtered)|Tagging Inconsistencies
SpritHansi
Posts: 57
Joined: Sun Jun 18, 2006 4:43 pm
Contact:

Re: RegExp Find & Replace 3.6 w/ 101 presets (2009-07-02)[MM2+3]

Post by SpritHansi »

Thanks :D
Regards
SpritHansi
Guest

Re: RegExp Find & Replace 3.6 w/ 101 presets (2009-07-02)[MM2+3]

Post by Guest »

Owyn wrote:Here is one that has been bugging me for a while. I regularly need to get OrginalArtist from a title.
Replace with: ^.*
Into: Original Artist
Regexp 1: checked
Replace with: RegExp(oSongData.Title, "[^\(]*(?= cover\))", 0)
VBScript: checked
Owyn
Posts: 2018
Joined: Fri Mar 21, 2008 10:55 am
Location: Canada
Contact:

Re: RegExp Find & Replace 3.6 w/ 101 presets (2009-07-02)[MM2+3]

Post by Owyn »

Ahhh! :lightbulb:
Thanks. :D
Cogito cogito ergo cogito sum. (Ambrose Bierce)
I drink therefore I am. (Monty Python)
Vista 32bit Home Premium SP2 / MM3.2.1.1297 Gold / Last.Fm 1.0.2.22 / IE8
Dell Inspiron 530 (1.8 Core2 / 2GB)
Skin: Vitreous Blue
Scripts: Add/Remove Playstat|Advanced Duplicate Find & Fix|Album Art Tagger|Backup|Batch Art Finder|Calculate Cover Size|Case&Leading Zero Fixer|DB_Audit|DB_Clean|DB_Schema|Event Logger|Genre Finder|Lyricator|Magic Nodes|MM2VLC|Monkey Rok|MusicIP Tagger|PUID Generator|RegExp Find & Replace|Right Click for Scripts|Scriptreloader|SQL Viewer|Stats(Filtered)|Tagging Inconsistencies
-SuperFunk-
Posts: 45
Joined: Tue Aug 05, 2008 4:16 pm
Contact:

Re: RegExp Find & Replace 3.6 w/ 101 presets (2009-07-02)[MM2+3]

Post by -SuperFunk- »

Because I don't know much about programming etc, i want to ask what i've got to do:

on allmusic.com I browse albums to copy the column of 'styles' into the MM-field 'grouping'
I get then:
* Album Rock
* Contemporary Pop/ Rock
* Rock & Roll
Then I adjusted the command to change * to ;
the result is:
; Album Rock
; Contemporary Pop/ Rock
; Rock & Roll
What do I need to do to get this:
Album Rock; Contemporary Pop/ Rock; Rock & Roll
- Remove the first ;
- Delete " " (the space before every ; )
buckw
Posts: 26
Joined: Tue Aug 21, 2007 3:08 pm
Location: Texas
Contact:

Re: RegExp Find & Replace 3.6 w/ 101 presets (2009-07-02)[MM2+3]

Post by buckw »

This looks like an extremely useful script, but I am having a little trouble with insatllation. Specifically, I receive the following error code: 800A01F4. The specific error is "Variable is undefined 'SDB'", at line 1101, character 5. I would appreciate your help in resolving the problem.

Thank you.

Edit: Never mind! I just downloaded with Firefox and all is well. Thanks!
Guest

Re: RegExp Find & Replace 3.6 w/ 101 presets (2009-07-02)[MM2+3]

Post by Guest »

-SuperFunk- wrote:What do I need to do to get this:
Album Rock; Contemporary Pop/ Rock; Rock & Roll
- Remove the first ;
- Delete " " (the space before every ; )
How do you have multiple lines of text inside of the Grouping field? AFAIK, Grouping field is just single-line. Anyway, you could try this:
Find what: ^;\s?|\s*(?=;)
Regexp 1: checked
Replace with: empty
-SuperFunk-
Posts: 45
Joined: Tue Aug 05, 2008 4:16 pm
Contact:

Re: RegExp Find & Replace 3.6 w/ 101 presets (2009-07-02)[MM2+3]

Post by -SuperFunk- »

Guest wrote:
-SuperFunk- wrote:What do I need to do to get this:
Album Rock; Contemporary Pop/ Rock; Rock & Roll
- Remove the first ;
- Delete " " (the space before every ; )
How do you have multiple lines of text inside of the Grouping field? AFAIK, Grouping field is just single-line. Anyway, you could try this:
Find what: ^;\s?|\s*(?=;)
Regexp 1: checked
Replace with: empty
By copying the styles-column from allmusic in the grouping-field i get multiple lines, Don't ask me why :)
Thanks for your help, it worked. I'm very happy.
Guest

Re: RegExp Find & Replace 3.6 w/ 101 presets (2009-07-02)[MM2+3]

Post by Guest »

-SuperFunk- wrote:By copying the styles-column from allmusic in the grouping-field i get multiple lines
By the way, you could do previous two steps (replacing "*" with ";" and removing " ") with just single preset:
Find what: (^\*\s*)|(\s+\*)
Regexp 1: checked
Replace with: MapArray(Array("$1", "", "$2", ";"))
VBScript: checked
-SuperFunk-
Posts: 45
Joined: Tue Aug 05, 2008 4:16 pm
Contact:

Re: RegExp Find & Replace 3.6 w/ 101 presets (2009-07-02)[MM2+3]

Post by -SuperFunk- »

Guest wrote:
-SuperFunk- wrote:By copying the styles-column from allmusic in the grouping-field i get multiple lines
By the way, you could do previous two steps (replacing "*" with ";" and removing " ") with just single preset:
Find what: (^\*\s*)|(\s+\*)
Regexp 1: checked
Replace with: MapArray(Array("$1", "", "$2", ";"))
VBScript: checked
Thanks! :)
boboberri2

Re: RegExp Find & Replace 3.6 w/ 101 presets (2009-07-02)[MM2+3]

Post by boboberri2 »

Hi can somebody please explain to me how this thing works?
Really simple, like I'm in kindergarten.

I have thousands of files that got renamed with the artist name in the title, so the titles all go, "artist name - song title." Is there any way to replace all of them at once by searching for everything up to and including the dash and the space that follows it? Or do I have to do each artist one at a time? Thanks for any help.
Guest

Re: RegExp Find & Replace 3.6 w/ 101 presets (2009-07-02)[MM2+3]

Post by Guest »

boboberri2 wrote:Is there any way to replace all of them at once by searching for everything up to and including the dash and the space that follows it? Or do I have to do each artist one at a time?
Yes, you could replace all of them at once. First, you should take a look at which presets already exist. Your description is not very clear, but I suppose you could use the "Remove the artist name from the Title" preset. Actually, it removes anything in the front of the Title before (and including) the dash, not matter if it is really the artist name or not. If you want to be sure to remove only string part which is exactly same as the artist name, then you could create a new preset with the following settings:
Find what: ^(.*?-\s*)
Into: Title
Regexp 1: checked
Replace with: IIf(Len(RegExp("$&", "^" & RegSub(oSongData.ArtistName, "(\W)", "\$$1") & "\s*-\s*", 0)) > 0, "", "$&")
VBScript: checked
-SuperFunk-
Posts: 45
Joined: Tue Aug 05, 2008 4:16 pm
Contact:

Re: RegExp Find & Replace 3.6 w/ 101 presets (2009-07-02)[MM2+3]

Post by -SuperFunk- »

I have a new question:

I have added multiple music-styles to the grouping field, separated by ;
eg

Code: Select all

Cuban Jazz; World Fusion; Latin Jazz; Afro-Cuban Jazz; Post-Bop
Now I want to generate auto-playlists for every genre I have, (by defining that the grouping field must contain the name of the genre)
I encountered a problem:
for the playlist 'Cuban Jazz' I get following item that doesn't belong in the list:
Afro-Cuban Jazz; Post-Bop; Latin Jazz; Cool; World Fusion
-> no 'Cuban Jazz' here, but because of 'Afro-Cuban Jazz; this item is added to the playlist

I have thought about a possible solution, and the only thing I can think about is that I give 'Cuban Jazz' an alternative name, let's say 'Kuban Jazz'
but how do i have to fill in the command lines in this script to make this possible?
I don't want the script to change the 'Afro-Cuban Jazz' to 'Afro-Kuban Jazz' ,
only 'cuban jazz' to 'Kuban jazz'
Guest

Re: RegExp Find & Replace 3.6 w/ 101 presets (2009-07-02)[MM2+3]

Post by Guest »

-SuperFunk- wrote:I want to generate auto-playlists for every genre I have, (by defining that the grouping field must contain the name of the genre)
I encountered a problem:
for the playlist 'Cuban Jazz' I get following item that doesn't belong in the list:
Afro-Cuban Jazz; Post-Bop; Latin Jazz; Cool; World Fusion
-> no 'Cuban Jazz' here, but because of 'Afro-Cuban Jazz; this item is added to the playlist
Did you try to specify: Grouping - contains - "; Cuban Jazz", and Grouping - starts with - "Cuban Jazz" with Match Any?
-SuperFunk-
Posts: 45
Joined: Tue Aug 05, 2008 4:16 pm
Contact:

Re: RegExp Find & Replace 3.6 w/ 101 presets (2009-07-02)[MM2+3]

Post by -SuperFunk- »

Guest wrote:
-SuperFunk- wrote:I want to generate auto-playlists for every genre I have, (by defining that the grouping field must contain the name of the genre)
I encountered a problem:
for the playlist 'Cuban Jazz' I get following item that doesn't belong in the list:
Afro-Cuban Jazz; Post-Bop; Latin Jazz; Cool; World Fusion
-> no 'Cuban Jazz' here, but because of 'Afro-Cuban Jazz; this item is added to the playlist
Did you try to specify: Grouping - contains - "; Cuban Jazz", and Grouping - starts with - "Cuban Jazz" with Match Any?
Yes, but that wouldn't solve my problem.
the following item won't be added to the list
Cuban Pop; Alternative/ Indie Rock; Adult Alternative Pop/ Rock; Contemporary Pop/ Rock; Cuban Traditions; Cuban Jazz; Latin Jazz; World Fusion
-> no 'Afro-cuban jazz', only 'Cuban Jazz' but the line doesn't begin with 'cuban jazz'

I need to rename the 'cuban Jazz' to something alternative, but I want the rest of the style-tags to be unchanged (especially afro-cuban jazz in this example)
Can this script recognize the styles separated by ; so that it only takes 'cuban jazz' but not 'afro-cuban jazz' and then change it easily to an alternative?

NOTE: I have also other problems like 'electronic' vs 'experimental electronic' vs 'experimental'
-> I need a solution for this.
Post Reply