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

MMFrLife
Posts: 2894
Joined: Fri Oct 26, 2012 9:04 pm
Location: MM Forum

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

Post by MMFrLife »

Whoa!!! Looks like the Z man is doing his rain dance again and makin' it rain presets!
Thanks! I'll have to look into some of those and post back here later.
Last edited by MMFrLife on Mon Jun 15, 2015 6:47 pm, edited 1 time in total.
MM user since 2003 (lifetime lic. 2012) "Trying to imagine life without music gives me a headache"
Top 2 scripts: RegExp Find & Replace (e.v.) and Magic Nodes (e.v.) ZvezdanD's scripts site
Please take a moment to read the bottom of the linked page to support the one and only - ZvezdanD! (the "originator" since 2006).
MMW 4.1.31.1919; 5.0.4.2690 || back it up...frequently!
|| software for power users: "Q-Dir" (free alt. to explorer) and file/folder renamer: "ReNamer" (den4b)
"The absurd is the essential concept and the first truth"
😜
MMFrLife
Posts: 2894
Joined: Fri Oct 26, 2012 9:04 pm
Location: MM Forum

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

Post by MMFrLife »

terrypin wrote:So it sounds like the RegEx used by the add-on differs in syntax or functionality in some way.
Yes, I figured as much. With Z's confirmation, it looks to be the case.

Thanks again, though!
MM user since 2003 (lifetime lic. 2012) "Trying to imagine life without music gives me a headache"
Top 2 scripts: RegExp Find & Replace (e.v.) and Magic Nodes (e.v.) ZvezdanD's scripts site
Please take a moment to read the bottom of the linked page to support the one and only - ZvezdanD! (the "originator" since 2006).
MMW 4.1.31.1919; 5.0.4.2690 || back it up...frequently!
|| software for power users: "Q-Dir" (free alt. to explorer) and file/folder renamer: "ReNamer" (den4b)
"The absurd is the essential concept and the first truth"
😜
MMFrLife
Posts: 2894
Joined: Fri Oct 26, 2012 9:04 pm
Location: MM Forum

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

Post by MMFrLife »

I've tried out the first preset and got it to work great. It is saved in my preset menu now. I haven't tried out the other ones but looking forward to
coming across the need, to see if they work. I'll edit back here if I do.
MM user since 2003 (lifetime lic. 2012) "Trying to imagine life without music gives me a headache"
Top 2 scripts: RegExp Find & Replace (e.v.) and Magic Nodes (e.v.) ZvezdanD's scripts site
Please take a moment to read the bottom of the linked page to support the one and only - ZvezdanD! (the "originator" since 2006).
MMW 4.1.31.1919; 5.0.4.2690 || back it up...frequently!
|| software for power users: "Q-Dir" (free alt. to explorer) and file/folder renamer: "ReNamer" (den4b)
"The absurd is the essential concept and the first truth"
😜
pintree3
Posts: 60
Joined: Tue Oct 16, 2007 6:19 am
Contact:

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

Post by pintree3 »

Is there a way to back this up? I'm moving country and won't be taking my PC with me--hence will need to reinstall my MM once I get a new one.
I love this plugin--what a godsend :-) Seeing that about 2/3 of the commands I don't use I deleted them, and I modified a few of the others. I would hate to do it all over again hence me asking--and if it is possible to save them, can they migrate to the new version 4.4?
Camus II

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

Post by Camus II »

The presets that are in use via Edit > Tag Manipulation Presets are stored in ..\AppData\Roaming\MediaMonkey\MediaMonkey.ini under the heading [RegExpPresets]. So just keep a back up copy of MediaMonkey.ini (or keep a separate text copy of your presets) and then you can copy and paste the [RegExpPresets] settings from that into any other/future installations.
pintree3
Posts: 60
Joined: Tue Oct 16, 2007 6:19 am
Contact:

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

Post by pintree3 »

Camus II wrote:The presets that are in use via Edit > Tag Manipulation Presets are stored in ..\AppData\Roaming\MediaMonkey\MediaMonkey.ini under the heading [RegExpPresets]. So just keep a back up copy of MediaMonkey.ini (or keep a separate text copy of your presets) and then you can copy and paste the [RegExpPresets] settings from that into any other/future installations.
I'm sure I had replied to this thanking you but I can't seem to see my reply--sorry but I did.
Anyhow another question popped up, or rather a part of my 1st question. I had asked what happens since there is now a new version?
You may have answered this but let me ask again and then go back to what may have been your answer.
Could I assume that if I install the new 4.4 version on top of this one all my previous deletes and modifications will be lost? OR if I back up my settings now and then in my new system install the new version, and then after this, replace my present .ini file then I would screw things up, wouldn't I?
Assuming yes to both, would it be safe to assume that installing a new version will automatically any changes made? or is there a way around this?
About your answer, you wrote, "or keep a separate text copy of your presets" I found that part in the .ini file. If I install the new version will changing this part alone affect anything else?

Thanks again
ZvezdanD
Posts: 3270
Joined: Thu Jun 08, 2006 7:40 pm

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

Post by ZvezdanD »

Here is the excerpt from the Installation section of the first post of this thread (and from the add-on's Web page in that matter):
"If you are upgrading this add-on from some old version, especially if there is updated syntax of presets, it is strongly recommend to follow these steps:
1. make a backup of your own created presets using the Edit / RegExp Export/Import dialog box;
2. uninstall old version of add-on and choose Yes when you are asked if you want to remove add-on settings;
3. install the new version of add-on;
4. import your own created presets using the Edit / RegExp Export/Import dialog box.

In that way you would always have the latest and updated presets. If you don't remove old settings (together with presets), during the installation this script would check the preset's names and if they are same as old ones it would skip their installation, even if they are updated."

The add-on's menu is modified in the 4.4 version. So, when you want to import presets, instead of Edit / RegExp Export/Import option there is now Edit / RegExp Find and Replace / Manage Presets option (now it could be found in the popup menus and the toolbar as well). When I am already at it, maybe I should mention that instead of Edit / RegExp Find and Replace option now you could use Edit / RegExp Find and Replace / Preset Settings option to get the same RegExp main 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
Haaden2
Posts: 23
Joined: Thu Sep 09, 2010 12:03 pm

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

Post by Haaden2 »

This is a great add-on! Having one spot of trouble, though:

Getting "Expression Error!" using Preset 155 Remove duplicate items in multi-item <Into Field>.... I have not modified the preset.

Code: Select all

Preset155=Name: "Remove duplicate items in multi-item <Into Field>...", Description: "Rock; Prog-Rock; Rock; Art Rock -> Rock; Prog-Rock; Art Rock", Shortcut: "", Icon: "", Toolbar: 0, FindWhat: "^.*", FindInto: "Genre", FindRegExp: 1, WholeWord: 0, ReplaceWith: "Execute(""Dim aItems, bMatch, sField, ii, jj: aItems = Split(Replace(sBefore, """"; """", """";""""), """";""""): For ii = 0 To UBound(aItems): bMatch = False: For jj = 0 To ii - 1: If aItems(jj) = aItems(ii) Then bMatch = True: Exit For: End If: Next: If Not bMatch Then sField = sField & aItems(ii) & """"; """": End If: Next: If Len(sField) Then sField = Left(sField, Len(sField) - 2) End If: iVariable(0) = sField"") & iVariable(0)", ReplaceFrom: "Title", ReplaceRegExp: 0, ReplaceVBScr: 1, MatchCase: 0
Maybe there's a simple tweak I need to make?
ZvezdanD
Posts: 3270
Joined: Thu Jun 08, 2006 7:40 pm

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

Post by ZvezdanD »

Haaden2 wrote:Getting "Expression Error!" using Preset 155 Remove duplicate items in multi-item <Into Field>....
I cannot try it right now, so let me know if this works:

Code: Select all

Preset155=Name: "Remove duplicate items in multi-item <Into Field>...", Description: "Rock; Prog-Rock; Rock; Art Rock -> Rock; Prog-Rock; Art Rock", Shortcut: "", Icon: "", Toolbar: 0, FindWhat: "^.*", FindInto: "Genre", FindRegExp: 1, WholeWord: 0, ReplaceWith: "Execute(""Dim aItems, bMatch, sField, iItem, jItem: aItems = Split(Replace(sBefore, """"; """", """";""""), """";""""): For iItem = 0 To UBound(aItems): bMatch = False: For jItem = 0 To iItem - 1: If aItems(jItem) = aItems(iItem) Then bMatch = True: Exit For: End If: Next: If Not bMatch Then sField = sField & aItems(iItem) & """"; """": End If: Next: If Len(sField) Then sField = Left(sField, Len(sField) - 2) End If: SetVar 0, sField"") & GetVar(0)", ReplaceFrom: "Title", ReplaceRegExp: 0, ReplaceVBScr: 1, MatchCase: 0
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
MMFrLife
Posts: 2894
Joined: Fri Oct 26, 2012 9:04 pm
Location: MM Forum

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

Post by MMFrLife »

I like setting the track numbers for multi-disc releases (2+ discs) consecutively (ex.: if discs contain 10 tracks each, track order would run 09, 10, 11, 12, 13 .....).

However, I also like to keep a record of what the original track ordering is per disc at the end of the filename and title field, ex.: filename =
It's a Party Tonight [01_01].mp3. . That is where [01_01] = Disc 1, track 1.

I can already achieve this, but it takes multiple steps (some of which, I'm guessing, can't be avoided). Provided the track numbers are already set with a leading
zero, the disc # is then set (with leading zero for 1 - 9) and I hold off on the consecutive tracking and copy filename to the title until the end, is there a way to get at least the "[01_01]" part done in a single step?
MM user since 2003 (lifetime lic. 2012) "Trying to imagine life without music gives me a headache"
Top 2 scripts: RegExp Find & Replace (e.v.) and Magic Nodes (e.v.) ZvezdanD's scripts site
Please take a moment to read the bottom of the linked page to support the one and only - ZvezdanD! (the "originator" since 2006).
MMW 4.1.31.1919; 5.0.4.2690 || back it up...frequently!
|| software for power users: "Q-Dir" (free alt. to explorer) and file/folder renamer: "ReNamer" (den4b)
"The absurd is the essential concept and the first truth"
😜
ZvezdanD
Posts: 3270
Joined: Thu Jun 08, 2006 7:40 pm

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

Post by ZvezdanD »

MMFrLife wrote:I like setting the track numbers for multi-disc releases (2+ discs) consecutively (ex.: if discs contain 10 tracks each, track order would run 09, 10, 11, 12, 13 .....).

However, I also like to keep a record of what the original track ordering is per disc at the end of the filename and title field, ex.: filename =
It's a Party Tonight [01_01].mp3. . That is where [01_01] = Disc 1, track 1.

I can already achieve this, but it takes multiple steps (some of which, I'm guessing, can't be avoided). Provided the track numbers are already set with a leading
zero, the disc # is then set (with leading zero for 1 - 9) and I hold off on the consecutive tracking and copy filename to the title until the end, is there a way to get at least the "[01_01]" part done in a single step?
You should have initially filed the original Disc # and Track #, then you could append that data to the end of e.g. Title and just then you could eventually modify Track # to have consecutive numbers for all multi-discs.

Preset: Append [Disc #_Track #] to the <Into Field>...
Description: With leading zeroes to the single-digit Disc and Track numbers
Find what: $
Regular expression 1: checked
Replace with: IIf(Len("$_") > 0, " ", "") & "[" & Right("00" & oSongData.DiscNumberStr, 2) & "_" & Right("00" & oSongData.TrackOrderStr, 2) & "]"
VBScript expression: checked

The next part could be done in two ways: using the total number of tracks from each disc or using the maximal Track # from each disc (if you have discs with all tracks and if they all have correctly filled the Track # info, then these two presets would give the same result).

Preset: Make consecutive Track # for multi-disc albums using total number of tracks from each disc
Description: If first disc has 8 tracks, Disc # = 2 and Track # = 1 -> Track # = 9
Find what: ^.*
Into: Track #
Regular expression 1: checked
Replace with: oSongData.TrackOrderStr + IIf(Int("0" & oSongData.DiscNumberStr) > 1, SQLQuery("SELECT Count(*) FROM Songs WHERE IDAlbum = " & oSongData.Album.ID & " AND DiscNumber < 0" & oSongData.DiscNumberStr & " GROUP BY IDAlbum"), 0)
VBScript expression: checked

If you want to use the next preset, it is very important that you sort tracks in the main tracklist by descending order of Disc # before selecting tracks and applying the preset:
Preset: Make consecutive Track # for multi-disc albums using maximal Track # from each disc
Description: If Track # of the last track from the first disc is 8, Disc # = 2 and Track # = 1 -> Track # = 9
Find what: ^.*
Into: Track #
Regular expression 1: checked
Replace with: oSongData.TrackOrderStr + IIf(Int("0" & oSongData.DiscNumberStr) > 1, SQLQuery("SELECT Sum(MaxNo) FROM (SELECT Max(CAST(TrackNumber AS integer)) AS MaxNo FROM Songs WHERE IDAlbum = " & oSongData.Album.ID & " AND DiscNumber < 0" & oSongData.DiscNumberStr & " GROUP BY IDAlbum, DiscNumber)"), 0)
VBScript expression: checked

Finally, you could clear the Disc # using the existing "Clear <Into Field>..." preset or assign 1 to all tracks.
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
dtsig
Posts: 3588
Joined: Mon Jan 24, 2011 6:34 pm

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

Post by dtsig »

I am looking through trying to figure a way to change <title> to actually contain "S"01"E"01 Title of video

So if now TITLE="Love is Beautiful" and Season# = 1 and Episode# = 1 then I want title to be:

S01E01 Love is Beautiful

I am sure that this can do it but haven't figured how to replace an attribute with combined attributes.

Help would be very welcomed
Where's the db and ini stored
Reporting Bugs
Where tags are stored

Not affiliated with MediaMonkey ... just a RABID user/lover
DTSig
ZvezdanD
Posts: 3270
Joined: Thu Jun 08, 2006 7:40 pm

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

Post by ZvezdanD »

dtsig wrote:I am looking through trying to figure a way to change <title> to actually contain "S"01"E"01 Title of video
Preset: Add Season # and Episode # to the begin of <Into Field>...
Description: With leading zeroes to the single-digit Season and Episode numbers
Find what: ^.*
Into: Title
Regular expression 1: checked
Replace with: "S" & Right("0" & oSongData.SeasonNumber, 2) & "E" & Right("0" & oSongData.EpisodeNumber, 2) & IIf(Len("$&") > 0, " $&", "")
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
dtsig
Posts: 3588
Joined: Mon Jan 24, 2011 6:34 pm

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

Post by dtsig »

ZvezdanD wrote:
dtsig wrote:I am looking through trying to figure a way to change <title> to actually contain "S"01"E"01 Title of video
Preset: Add Season # and Episode # to the begin of <Into Field>...
Description: With leading zeroes to the single-digit Season and Episode numbers
Find what: ^.*
Into: Title
Regular expression 1: checked
Replace with: "S" & Right("0" & oSongData.SeasonNumber, 2) & "E" & Right("0" & oSongData.EpisodeNumber, 2) & IIf(Len("$&") > 0, " $&", "")
VBScript expression: checked
WOW .. thanks man .. what a great guy you are .. cheers ..

EDITED: And of course this worked perfectly .. thanks again.
Where's the db and ini stored
Reporting Bugs
Where tags are stored

Not affiliated with MediaMonkey ... just a RABID user/lover
DTSig
MMFrLife
Posts: 2894
Joined: Fri Oct 26, 2012 9:04 pm
Location: MM Forum

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

Post by MMFrLife »

ZvezdanD wrote:You should have initially filed the original Disc # and Track #, then you could append that data to the end of e.g. Title and just then you could eventually modify Track # to have consecutive numbers for all multi-discs.

Preset: Append [Disc #_Track #] to the <Into Field>...
Description: With leading zeroes to the single-digit Disc and Track numbers
Find what: $
Regular expression 1: checked
Replace with: IIf(Len("$_") > 0, " ", "") & "[" & Right("00" & oSongData.DiscNumberStr, 2) & "_" & Right("00" & oSongData.TrackOrderStr, 2) & "]"
VBScript expression: checked
Exactly what I was looking for!!! It worked like a charm. The other two look interesting as well. Thanks again. You're the man! 8)
MM user since 2003 (lifetime lic. 2012) "Trying to imagine life without music gives me a headache"
Top 2 scripts: RegExp Find & Replace (e.v.) and Magic Nodes (e.v.) ZvezdanD's scripts site
Please take a moment to read the bottom of the linked page to support the one and only - ZvezdanD! (the "originator" since 2006).
MMW 4.1.31.1919; 5.0.4.2690 || back it up...frequently!
|| software for power users: "Q-Dir" (free alt. to explorer) and file/folder renamer: "ReNamer" (den4b)
"The absurd is the essential concept and the first truth"
😜
Post Reply