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

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

Moderators: Peke, Gurus

MM3 monkey
Posts: 455
Joined: Mon Aug 27, 2007 2:34 am

Re: RegExp Find & Replace 4.1 w/ 217 presets (2011-03-03) [M

Post by MM3 monkey »

Hello, ZvezdanD.

I've got some tracks that I stupidly tagged like this for a specific reason ages ago. I want to put them right again:

In the Title field I have: song title/artist's name [there are no spaces between the end of the title, the "/", and the beginning of the artist.]
In the Artist field I have: Useless nonsense
In the Album Artist field I have: Useless nonsense

Can I use this script to take the artist out of the Title field and put it into the Artist and also the Album Artist fields, overwriting their current contents. I.e. I need the replace the Artist and Album Artist fields with everything after the "/" in the Title field.

Then I just need to remove the "/" from the end of the Title field.

Many thanks.
ZvezdanD
Posts: 3265
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 4.1 w/ 217 presets (2011-03-03) [M

Post by ZvezdanD »

MM3 monkey wrote:Can I use this script to take the artist out of the Title field and put it into the Artist
Find what: ^.*
Into: Artist
Regular expression 1: checked
Replace with: IIf(InStr(oSongData.Title, SetVar(0, "<String Caption="Separator" Value="/">")) > 0, Mid(oSongData.Title, InStrRev(oSongData.Title, GetVar(0)) + Len(GetVar(0))), "$&")
VBScript expression: checked
MM3 monkey wrote:and also the Album Artist fields, overwriting their current contents
"Copy <From Field> to <Into Field>" preset, Source = Artist, Destination = Album Artist
MM3 monkey wrote:Then I just need to remove the "/" from the end of the Title field.
"Remove the end of <Into Field> after (and including) specified string" preset, Destination = Title, specified string = /
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
MM3 monkey
Posts: 455
Joined: Mon Aug 27, 2007 2:34 am

Re: RegExp Find & Replace 4.1 w/ 217 presets (2011-03-03) [M

Post by MM3 monkey »

Thanks, you're amazing.

However, the last part of your walkthrough doesn't seem to work.

I ran the "Remove the end of <Into Field> after (and including) specified string" preset as follows:

Destination field = Title
Trim string after: /

But nothing happened. The title still contains "song title/artist's name"

I'm using MM4.
Last edited by MM3 monkey on Sun Jun 19, 2011 5:30 am, edited 1 time in total.
ZvezdanD
Posts: 3265
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 4.1 w/ 217 presets (2011-03-03) [M

Post by ZvezdanD »

MM3 monkey wrote:I ran the "Remove the end of <Into Field> after (and including) specified string" preset as follows:

Destination field = Title
Trim string after: /

But nothing happened.
Thanks for the report. You are right, that implementation works only if the specified string is preceded with a space character. You need to modify Find what string in that preset like this:

Code: Select all

\s*<String Caption="Trim string after" Value="/">(.|\s)*$
i.e. instead of \s+ at the begin it should be \s*.
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
MM3 monkey
Posts: 455
Joined: Mon Aug 27, 2007 2:34 am

Re: RegExp Find & Replace 4.1 w/ 217 presets (2011-03-03) [M

Post by MM3 monkey »

^ Fantastic. And greatly appreciated as ever.
kiwichick
Posts: 342
Joined: Tue Jul 21, 2009 6:35 am

Re: RegExp Find & Replace 4.1 w/ 217 presets (2011-03-03) [M

Post by kiwichick »

"why would you need that field with this add-on"

MM4 will import Music Video files to the Video node unless they have Genre set to Music Video when they're scanned into the Library. They then need to have the Type (or genre) changed to Music Video so they'll appear in the Music Video node instead. I would use an REFR button to batch change the Type. Yes I could use it to change the Genre field but I prefer to use the Type field and leave Genre free for actual genres.

"you could just use Properties dialog box"

Yes but an REFR toolbar button is so much quicker :D

And, as far as I'm concerned, you can call the new field whatever you like and whatever is easiest for you :D :D
ZvezdanD
Posts: 3265
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 4.2 w/ 253 presets (2011-06-21) [M

Post by ZvezdanD »

murraynt wrote:is there an option to select everything at once?
kiwichick wrote:Would it be possible, in a future update, to add a new field to go with MM4's field for the type of media added - music, video, music video, podcast, etc?
There is the new update, v4.2 - 2011-06-21
* Added: All Text Fields item to Into and From dropdown lists which allows assigning the same value to the several fields at once (with MM 3.1 or higher it could be specified which fields you want to modify using settings in the Search sheet of the Options dialog box; please be careful with that option, especially with the specified Path field!);
* Added: possibility to specify <From Field> tag in the Replace with string which would be replaced with the field specified in the dropdown list next to the << button when the VBScript expression is turned on (this allows more generic presets that could be used with any selected field instead of hard-coded ones in the Replace with string);
* Added: Series, Director, Producer, Actor, Parental Rating, Episode #, Season # and Type (new) fields. [MM4];
* Changed: old Type field to Extension, Original Album Title to Original Title, Skip Counter to Skipped # (please update your own presets that contain these fields);
* Added: 36 new presets, most of them using the new possibility with the <From Field> tag; the most important new preset is "Swap <From Field> and <Into Field>" which shows how it is possible to use single preset to modify two or more fields at once; some old presets are fixed;
* Fixed: case modification of Path/Folder.
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
kiwichick
Posts: 342
Joined: Tue Jul 21, 2009 6:35 am

Re: RegExp Find & Replace 4.2 w/ 253 presets (2011-06-21) [M

Post by kiwichick »

I've installed the new version but I have a problem with the Type field. This is my preset:

Image

If I run it from there I get this:

Image

And if I run it from the toolbar button I get this:

Image

I've tried it on MM4 and MM4Portable with the same result.
ZvezdanD
Posts: 3265
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 4.2 w/ 253 presets (2011-06-21) [M

Post by ZvezdanD »

kiwichick wrote:I've installed the new version but I have a problem with the Type field.
Thanks for the report. There is the new release, v4.2.1 - 2011-06-22:
* Fixed: error when replacing Type field [MM4].
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
kiwichick
Posts: 342
Joined: Tue Jul 21, 2009 6:35 am

Re: RegExp Find & Replace 4.2 w/ 253 presets (2011-06-22) [M

Post by kiwichick »

Fabulous!!!! Thanks so much. I really missed my REFR!!!! And that new field is great!!!
Last edited by kiwichick on Wed Jun 22, 2011 9:11 pm, edited 1 time in total.
cheerios
Posts: 7
Joined: Sat Jul 02, 2011 3:32 pm

Re: RegExp Find & Replace 4.2 w/ 253 presets (2011-06-22) [M

Post by cheerios »

Hello,

Very nice addon. I'm no expert in regular expressions and I was wondering if someone can help:-)

I have some filenames in the following format:

PodcastName_Jun3011_Track 04.mp3

I'd like to set the Title Tag of the mp3 to be '2011-06-30 Track 04'

Any ideas how to this in a relatively painless manner?

Thanks much!
ZvezdanD
Posts: 3265
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 4.2 w/ 253 presets (2011-06-22) [M

Post by ZvezdanD »

cheerios wrote:I have some filenames in the following format:

PodcastName_Jun3011_Track 04.mp3

I'd like to set the Title Tag of the mp3 to be '2011-06-30 Track 04'
Find what: ^.*
Into: Title
Regular expression 1: checked
Replace with:

Code: Select all

Eval(IIf(Len(RegExp(oSongData.Path, SetVar(0, "^(?:.+?)\\(?:.+)\\(?:PodcastName_(.*?)(\d\d?)(\d\d)_(Track \d\d))\.(?:[^\.\\a-z]+)$"), 0)), "DateISO(CDate(RegSub(oSongData.Path, GetVar(0), ""$1/$2/$3""))) & RegSub(oSongData.Path, GetVar(0), "" $4"")", """$&"""))
VBScript expression: checked
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
cheerios
Posts: 7
Joined: Sat Jul 02, 2011 3:32 pm

Re: RegExp Find & Replace 4.2 w/ 253 presets (2011-06-22) [M

Post by cheerios »

Wow, thanks so much for the speedy response! I really appreciate you taking the time and effort to whip that up. I've defined a new preset as directed but I have not been able to get it to work yet. Still trying to figure out if I goofed up something. If you have any suggestions that might help debugging this, i'd be glad to hear them :-)
ZvezdanD
Posts: 3265
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 4.2 w/ 253 presets (2011-06-22) [M

Post by ZvezdanD »

cheerios wrote:I've defined a new preset as directed but I have not been able to get it to work yet.
Could you be a little bit more descriptive what is wrong? What is the version of the add-on that you are using? Could you post the screenshot of the RegExp dialog box?
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
beg
Posts: 193
Joined: Wed Feb 04, 2009 12:36 pm

Re: RegExp Find & Replace 4.2 w/ 253 presets (2011-06-22) [M

Post by beg »

Hi,

can you tell me if regexp in it's latest version is running on MM 4 beta?

cheers,
Bernhard
Post Reply