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 »

Have you already familiarized yourself with the basics of the script? If not, I suggest you do that first.

If so, you can use Replace specified string with another one in <Into Field>... preset to
replace CONTENTWARN with [Warning].

I can't remember if the standard version has the menu organized into groups. If so, it should be under Basic Manipulations.
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: 3257
Joined: Thu Jun 08, 2006 7:40 pm

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

Post by ZvezdanD »

If I understand correctly, jeremyryan wants to find one string in one field and to add another string to the another field in all matched files, so it is no use for the "Replace specified string with another one" preset.

Firstly, you should find files whose filenames contain CONTENTWARN. I don't know if the built-in Search option allows that, but it could be done with RegExp F&R or even better with Magic Nodes.

Secondly, you should select all matched files and choose the "Add specified string to the end of <Into Field> separated with space if not empty..." preset in RegExp F&R, select Title as destination field and specify [Warning].
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 »

Oh yes, I see it now, glanced over that. Good catch Z!
Although, jeremyryan, you may want to consider replacing CONTENTWARN with [Warning] at the the end of the filename as well.
It does look much nicer. Just my opinion :wink:
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"
😜
milflicker
Posts: 6
Joined: Wed Mar 25, 2015 1:45 pm

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

Post by milflicker »

Why is there no Copy Artist to Album Artist preset?

Can you please make one?
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 »

milflicker wrote:Why is there no Copy Artist to Album Artist preset?
The preset is, Copy <From Field> to <Into Field> (you change the from and into fields from their respective dropdown menus after
choosing that preset).

You can also save that as a custom preset, if you desire.
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 »

Scenario:
You have a 10, or so, track album. 7, or so, of the tracks have the correct artist but 3, or so, are different (not empty).

Solution:
Have a preset that will overwrite the incorrect entries with the majority (average) artist.
Actually, have it modifiable to which field (artist, album artist, album, etc.) is selected in the respective dropdowns.

Is that possible?
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: 3257
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:Scenario:
You have a 10, or so, track album. 7, or so, of the tracks have the correct artist but 3, or so, are different (not empty).

Solution:
Have a preset that will overwrite the incorrect entries with the majority (average) artist.
Actually, have it modifiable to which field (artist, album artist, album, etc.) is selected in the respective dropdowns.

Is that possible?
We had the conversation about this in e-mails and I though that you are satisfied with the solution that is now included in the latest version of the add-on.

There are the predefined "Assign Year/Genre if it is different from value assigned to most tracks from same album" presets that will do what you want for the Year and Genre fields. There are now also the similar presets for Artist and Album Artist fields. You cannot have such preset to write the correct value to the Album field since the preset cannot know which tracks belong to it, i.e. you need all tracks from some album to have the same Album.ID or AlbumName to be able to correct other fields.

It is possible to make the preset modifiable for different fields, but such preset would be huge and too much complicated because it cannot contain link to the From/Into dropdown controls since it is based on SQL.

If you want to correct values for some field that is not supported by included presets, you could modify the mentioned preset for Genre, replacing "Genre" with the SQL name of the wanted field in the Replace with string, but it is not always so simple for all fields. For example, here is the string which could correct the Grouping field which has GroupDesc SQL name:

IfNull(SQLQuery("SELECT GroupDesc, Count(GroupDesc) AS SortField FROM Songs WHERE IDAlbum = " & oSongData.Album.ID & " AND GroupDesc <> '' GROUP BY GroupDesc ORDER BY SortField DESC"), "$&")
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
milflicker
Posts: 6
Joined: Wed Mar 25, 2015 1:45 pm

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

Post by milflicker »

MMFrLife wrote:
milflicker wrote:Why is there no Copy Artist to Album Artist preset?
The preset is, Copy <From Field> to <Into Field> (you change the from and into fields from their respective dropdown menus after
choosing that preset).

You can also save that as a custom preset, if you desire.
So how do I make it so it always takes the main artist whom is usually listed first, such as PRIMARY ARTIST "feat. (and any other variation)" CONTRIBUTING ARTIST, and apply only the first as the album artist?
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

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

Post by ZvezdanD »

milflicker wrote:So how do I make it so it always takes the main artist whom is usually listed first, such as PRIMARY ARTIST "feat. (and any other variation)" CONTRIBUTING ARTIST, and apply only the first as the album artist?
The new version (v5) of the add-on has the "Assign [(main artists]) or main artists from <From Field> to <Into Field>" preset which could do that.
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
milflicker
Posts: 6
Joined: Wed Mar 25, 2015 1:45 pm

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

Post by milflicker »

ZvezdanD wrote:The new version (v5) of the add-on has the "Assign [(main artists]) or main artists from <From Field> to <Into Field>" preset which could do that.
Well since v4.4.6 is the most recent publicly available version, that doesn't really help me. :roll:
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 »

milflicker wrote:Well since v4.4.6 is the most recent publicly available version, that doesn't really help me. :roll:
It's a donate version and includes many magical/wonderful presets/functionality.

As far as just simple instruction on how to save,

1. Load the above mentioned preset
2. Adjust for fields desired
3. Rename the preset so as to be unique (this is the key to being saveable)
4. Create a unique menu for it in the Menu field. This isn't necessary, but if you don't create a
menu it will show on the menu as unclassified.

Note - renaming will cause the "ADD" button to appear at the upper right of the dialog
(but, if you change some things before the ADD button appears, do not press the Update button
If so, the original preset will be lost unless you reinstall the script or remember how to recreate
and save it). Use Update button only when your changes aren't to create a new preset based on another
one.


*** before you do anything, you should make sure Key MM files are backed up, as well as backing up
your RegExp... presets, using the script to do so.

*** also, you need to read over ZvezdanD's usage instructions for the script on his script page.
You can find the link in the original post or in my signature.
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 »

ZvezdanD wrote:We had the conversation about this in e-mails and I though that you are satisfied with the solution that is now included in the latest version of the add-on.
Ok, yes, sorry. I got it working now.

I did remember the conversation somewhat, but I mistakenly got it stuck in my head that because the request
had to do with "empty" examples, that is all we dealt with. You have added/included presets and variations on presets that
I have requested before and I've looked to see them afterwards, but I failed to look around at the presets after that correspondence
when the lastest version was released.

Anyway, what threw me was when I tried the original preset
example, it didn't work. Although, it was because I was doing it on
tracks that weren't in the library (from my Computer view).

Yes, of course, that makes sense on the Album column not working. Including that was a slip up.
Using the Album column to correct other fields (referential) is understandable. Although, it's a shame
that it also doesn't work when just trying to correct the album field (self-referential).
Apparently, these situations "always" need something else as the basis/foundation of their correction.
Are the only ways of fixing it to use MM's properties dialog or the script's simple use of Find What?

If the Album, Album Artist and Artist are all inconsistent, is the dream of using a Batch to rectify the
"whole" shebang a dead one?

My batch workaround would be to,

1st preset type: folder level path manipulation for album name
2nd preset type: Assign Album Artist if different than most....
3rd preset type: Assign Artist if different than most....

Any other ideas?
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: 3257
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:Anyway, what threw me was when I tried the original preset
example, it didn't work. Although, it was because I was doing it on
tracks that weren't in the library (from my Computer view).
The mentioned presets use SQL to find out which tracks belong to the same album; the SQL works only on tracks that are entered to the database, i.e. on tracks from the Library.
MMFrLife wrote:If the Album, Album Artist and Artist are all inconsistent, is the dream of uisng a Batch to rectify the
"whole" shebang a dead one?

My batch workaround would be to,

1st preset type: folder level path manipulation for album name
2nd preset type: Assign Album Artist if different than most....
3rd preset type: Assign Artist if different than most....

Any other ideas?
Yes, your batch workaround is way to go. You could use the "Assign left-specified folder level of Path to <Into Field>" as the 1st preset in the batch. Or, if your folders don't represent the album names, maybe you could use some of the next presets:
Preset: Assign Album if it is empty with value assigned to most tracks from same folder
Description: If 7 tracks have Album = "The Wall" and 3 tracks have "anything":•tracks with empty Album -> "The Wall"
Menu: Based on related files
Find what: ^$
Into: Album
RegEx (F): checked
Replace with: IfNull(SQLQuery("SELECT Album, Count(Album) AS SortField FROM Songs LEFT JOIN (SELECT IDMedia, CASE WHEN DriveLetter IS NOT NULL THEN SubStr('ABCDEFGHIJKLMNOPQRSTUVWXYZ', DriveLetter + 1, 1) ELSE '' END AS DriveStr FROM Medias) AS Medias2 ON Songs.IDMedia = Medias2.IDMedia WHERE Upper(Medias2.DriveStr || CASE WHEN Length(RTrim(SongPath, Replace(SongPath, '\', ''))) > 0 THEN SubStr(SongPath, 1, Length(RTrim(SongPath, Replace(SongPath, '\', '')))) ELSE '' END) = '" & UCase(Replace(Left(oSongData.Path, InStrRev(oSongData.Path, "\")), "'", "''")) & "' AND Album <> '' GROUP BY Album ORDER BY SortField DESC"), "$&")
VBScript (R): checked

Preset: Assign Album if it is different from value assigned to most tracks from same folder
Description: If 7 tracks have Album = "The Wall" and remaining 3 tracks have "anything":•those 3 tracks -> "The Wall
Menu: Based on related files
Find what: ^.*
Into: Album
RegEx (F): checked
Replace with: IfNull(SQLQuery("SELECT Album, Count(Album) AS SortField FROM Songs LEFT JOIN (SELECT IDMedia, CASE WHEN DriveLetter IS NOT NULL THEN SubStr('ABCDEFGHIJKLMNOPQRSTUVWXYZ', DriveLetter + 1, 1) ELSE '' END AS DriveStr FROM Medias) AS Medias2 ON Songs.IDMedia = Medias2.IDMedia WHERE Upper(Medias2.DriveStr || CASE WHEN Length(RTrim(SongPath, Replace(SongPath, '\', ''))) > 0 THEN SubStr(SongPath, 1, Length(RTrim(SongPath, Replace(SongPath, '\', '')))) ELSE '' END) = '" & UCase(Replace(Left(oSongData.Path, InStrRev(oSongData.Path, "\")), "'", "''")) & "' AND Album <> '' GROUP BY Album ORDER BY SortField DESC"), "$&")
VBScript (R): 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
milflicker
Posts: 6
Joined: Wed Mar 25, 2015 1:45 pm

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

Post by milflicker »

MMFrLife wrote:It's a paid version and includes many magical/wonderful presets/functionality.
:roll: So like I said, v5 is not yet available.

Requiring people pay for something but calling it a "donation" is just so infuriating and I am not going to play these games.


Again...

How do I make it so it always takes the main artist whom is usually listed first, such as PRIMARY ARTIST "feat. (and any other variation)" CONTRIBUTING ARTIST, and apply only the first as the album artist?

Can someone please post the code that will do that?
Last edited by Lowlander on Sat Nov 05, 2016 6:38 pm, edited 2 times in total.
Reason: Language
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 »

Well, you said it wasn't publicly available, but it is. It doesn't matter whether you have to pay for it or donate for it or whatever you want to call it.
Usage of the term Donate means "it's free, but you can donate if you choose to". But it can also denote a method for required payment;
that it's up to you and not a fixed amount like standard payware (unless on sale, but even then it's fixed for the sale period).

I was trying to be helpful earlier, but posting the code is and should "rightfully" be up to the author.
...and altering the wording of my quote wasn't a very classy move. You could have essentially made your point without that. :wink:
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