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

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

ZvezdanD
Posts: 3101
Joined: Thu Jun 08, 2006 7:40 pm

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

Post by ZvezdanD » Sat Oct 15, 2011 5:24 am

Vyper wrote:In my above post I found where one could set a toolbar button but I'm not sure I've figured out how. I checked the appropriate box but do I need to assign an icon myself for it? If so, what size should it be?
You don't need to assign an icon to some preset to be able to get toolbar button. However, you need to confirm the modification of the preset by click on the Update button.
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.2  Add Currently Playing/Selected Track(s) to Playlist 1.1.2

Vyper
Posts: 845
Joined: Tue May 23, 2006 5:53 pm

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

Post by Vyper » Sat Oct 15, 2011 5:26 am

Thanks! :D
Stop Button Freak

ZvezdanD
Posts: 3101
Joined: Thu Jun 08, 2006 7:40 pm

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

Post by ZvezdanD » Mon Oct 17, 2011 10:18 am

ZvezdanD wrote:
tooone7 wrote:Is there some way that I can combine these two presets I have now? The one for the Season# and the one for the Episode#?
Not currently since that requires the modification of two fields at once.
Actually, if you are using RegExp add-on version 4.2 or newer, you could modify two or more fields at once using single preset, but that solution requires good VBScript knowledge and it is just temporary until I implement proper support for the action groups. The "Swap <From Field> and <Into Field>..." preset is an example how it is possible to do such modification (that preset is the only predefined one where both Source and Destination fields are modified, in all other cases only Destination field is modified).

Now, here are settings for your example where both Season# and Episode# are modified using single preset:
Find what: ^.*
Into: Season #
Regular expression 1: checked
Replace with: RegExpEx(<From Field>, "(.+)(s)?(\d{1,2})([ex])?(\d\d)(.+)?", 0, 2) & Eval(IIf(bReplacing, "Execute(""oSongData.EpisodeNumber = RegExpEx(<From Field>, """"(.+)(s)?(\d{1,2})([ex])?(\d\d)(.+)?"""", 0, 4)"")", """"""))
From: Filename
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.2  Add Currently Playing/Selected Track(s) to Playlist 1.1.2

DaveW
Posts: 1
Joined: Mon Oct 17, 2011 3:46 am

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

Post by DaveW » Mon Oct 17, 2011 5:27 pm

Thanks for the share on this. This is exactly what I needed to know.

Newbie

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

Post by Newbie » Tue Oct 18, 2011 4:30 am

ZvezdanD wrote:
Newbie wrote:Is it possible to Copy all Artist of the track then add them (cumulative) to Album Artist?
Find what: ^.*
Into: Album Artist
Regular expression 1: checked
Replace with: SQLQuery("SELECT group_concat(AA, '; ') FROM (SELECT DISTINCT Artists.Artist AS AA FROM Songs INNER JOIN ArtistsSongs ON Songs.ID = ArtistsSongs.IDSong AND (ArtistsSongs.PersonType = 1 OR ArtistsSongs.PersonType IS NULL) INNER JOIN Artists ON ArtistsSongs.IDArtist = Artists.ID WHERE IDAlbum = " & oSongData.Album.ID & ")")
VBScript expression: checked
Thank. It work but it seem to add all of the the Artist in the "Now Playing" list, instead of just selected track. Perhaps it intentional (due to the coding you wrote) or I didn't use it properly.

ZvezdanD
Posts: 3101
Joined: Thu Jun 08, 2006 7:40 pm

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

Post by ZvezdanD » Tue Oct 18, 2011 7:03 am

Newbie wrote:It work but it seem to add all of the the Artist in the "Now Playing" list, instead of just selected track. Perhaps it intentional (due to the coding you wrote) or I didn't use it properly.
It adds all artists from an album were the selected song(s) appear(s), it doesn't matter if all songs from that album are selected for modification or just one. So, you need to have entered the album name for all related tracks to be able to use that preset. Selected tracks would be modified in the main tracklist or in the Now Playing panel depending of that which of them is active, i.e. which has a keyboard focus.
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.2  Add Currently Playing/Selected Track(s) to Playlist 1.1.2

blinky74

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

Post by blinky74 » Fri Oct 21, 2011 11:10 pm

i LOVE this plug-in. thanks so much! wow, what a time saver.

one bug I am encountering is that when i Copy (featured Artist) from end of Title to Artist, it misses the first parenthesis. So
"Title (feat. Artist 2)" and "Artist 1"
gets changed to
"Title (feat. Artist 2)" and "Artist 1feat. Artist2)" with only one parenthesis.

alternatively, if i tell it to and put them in (), i get:
"Title (feat. Artist 2)" and "Artist 1(feat. Artist2))" with three parentheses.

a second (unrelated) observation: when i Remove (featuring artist) from end of Title, it removes everything in () including (Live), (remix) etc. even if there is a (featuring artist) and a (remix)

ZvezdanD
Posts: 3101
Joined: Thu Jun 08, 2006 7:40 pm

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

Post by ZvezdanD » Sat Oct 22, 2011 7:37 am

blinky74 wrote:one bug I am encountering is that when i Copy (featured Artist) from end of Title to Artist, it misses the first parenthesis.
Thanks for the report. That preset should have [^\]\)]+ instead of .+(?=\]|\)|$)

Code: Select all

RegSub(RegExp(oSongData.Title, "\b(?:ft\.?|feat\.?|featuring|vs\.?|versus|pres\.?|presents)\s[^\]\)]+", 0), "^.+$", " $$&")
blinky74 wrote:a second (unrelated) observation: when i Remove (featuring artist) from end of Title, it removes everything in () including (Live), (remix) etc. even if there is a (featuring artist) and a (remix)
Well, the name of the preset says "from the end of ...", so everything after "feat.|pres.|vs." until the end of the field is considered as a featuring artist. Even if I limit featuring artist to the "version|live|remix|...", how could I know where the name of the featuring artist ends and where starts something else? For example, what if I have Title = "Rain Down Love (feat. Siedah Garrett Freemasons Remix)", how could I know that "Siedah Garrett" is featuring artist, but not "Siedah Garrett Freemasons"?

If you have featuring artist and "version|live|remix|..." or anything else inside of separate parentheses, e.g. "Rain Down Love (feat. Siedah Garrett) (Freemasons Remix)" then you could get what you want if you modify that preset with [^\)|\]]+(?:\)|\]|$) instead of .+[\)|\]]?$

Code: Select all

\s*([\(|\[].*)?\b(?:ft\.?|feat\.?|featuring|vs\.?|versus|pres\.?|presents)\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.2  Add Currently Playing/Selected Track(s) to Playlist 1.1.2

lookinup03
Posts: 15
Joined: Sun Feb 08, 2009 11:01 pm

Re: RegExp Find & Replace

Post by lookinup03 » Fri Nov 04, 2011 9:36 pm

I would like to switch my album artist field with my artist field. I am not familiar with scripting so if someone would be kind enough to write the expression for me I would be really appreciative.
I thought about copying the artist field into any empty field I have, then moving the album artist into the artist field.I then would copy the " empty field" back into the artist field. The problem with all of that is the amount of time it would take and fragments it would leave on the hard drive. i have 30,000 songs.
Thanks

ZvezdanD
Posts: 3101
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace

Post by ZvezdanD » Sat Nov 05, 2011 2:28 am

lookinup03 wrote:I would like to switch my album artist field with my artist field.
Since v4.2 there is a predefined "Swap <From Field> and <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.2  Add Currently Playing/Selected Track(s) to Playlist 1.1.2

thefaceman
Posts: 367
Joined: Sun Aug 28, 2005 10:43 pm

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

Post by thefaceman » Thu Nov 10, 2011 9:12 am

Is there a 'guide' that helps explain what each 'preset' does in this script?

I am looking for the name of the present that finds the artist names that are swapped in the Artist field
(ex. Vaughn, Stevie Ray)

ZvezdanD
Posts: 3101
Joined: Thu Jun 08, 2006 7:40 pm

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

Post by ZvezdanD » Thu Nov 10, 2011 10:24 am

thefaceman wrote:Is there a 'guide' that helps explain what each 'preset' does in this script?
Each preset has its short description and I think it is enough in most cases. You could ask here if you need some more explanation about some preset.
thefaceman wrote:I am looking for the name of the present that finds the artist names that are swapped in the Artist field
(ex. Vaughn, Stevie Ray)
Well, there is not reliable way to detect such artists except by looking at the ", " character. However, in that case you would get artists like "Blood, Sweet & Tears" as well. Anyway, you could try the "Swap last and first name of <Into Field> with removed "", ""..." preset. Here is its description: "Hooker, John Lee -> John Lee Hooker (works with multi-item fields as well)". If you want to get displayed only tracks which artists have "xxx, yyy" format without actually modifying the Artist field, you could choose Keep Matched or Select Matched options instead of Replace All, or you could simply choose Find Next and you would get displayed such tracks one by one by each press on that button.
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.2  Add Currently Playing/Selected Track(s) to Playlist 1.1.2

thefaceman
Posts: 367
Joined: Sun Aug 28, 2005 10:43 pm

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

Post by thefaceman » Thu Nov 10, 2011 2:51 pm

ZvezdanD wrote:
thefaceman wrote:Is there a 'guide' that helps explain what each 'preset' does in this script?
Each preset has its short description and I think it is enough in most cases. You could ask here if you need some more explanation about some preset.
thefaceman wrote:I am looking for the name of the present that finds the artist names that are swapped in the Artist field
(ex. Vaughn, Stevie Ray)
Well, there is not reliable way to detect such artists except by looking at the ", " character. However, in that case you would get artists like "Blood, Sweet & Tears" as well. Anyway, you could try the "Swap last and first name of <Into Field> with removed "", ""..." preset. Here is its description: "Hooker, John Lee -> John Lee Hooker (works with multi-item fields as well)". If you want to get displayed only tracks which artists have "xxx, yyy" format without actually modifying the Artist field, you could choose Keep Matched or Select Matched options instead of Replace All, or you could simply choose Find Next and you would get displayed such tracks one by one by each press on that button.
This will take awhile for my brain to process, but you provide a VERY good description of what I need to do. Thanks for letting me 'learn' more about options in MM scripts. I can go play now...LOL :lol:

absence_media
Posts: 1
Joined: Tue Nov 15, 2011 9:45 am

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

Post by absence_media » Tue Nov 15, 2011 9:54 am

Hi, I'm stuck on copying the remix artist into the albumartist field.
There is a preset where you can assign it to a field, but it copies the word remix as well and in case there is no remix it empties the albumartist field.

So what I need is
Title = Track (abc remix)
to become
Title = Track (abc remix)
Albumartist = abc
Only when the word remix is mentioned. (No need for mix/edit etc.)

When there are more than one remix-artists, it should copy the whole collaboration into the albumartist field:
Title = Track (abc & def remix)
to become
Title = Track (abc & def remix)
Albumartist = abc & def

Can anyone help me with this?

Thanks

dwofford
Posts: 2
Joined: Tue Dec 19, 2006 2:36 pm

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

Post by dwofford » Tue Nov 15, 2011 10:14 am

I am having an issue with the Swap first and last name of <Into Field> with added ", "... preset when handling a list of names. The problem occurs when one of the names is a single name. For example

Orginal Data: Madonna; Mirwais Ahmadzaï

Transformed Data: Ahmadzaï, Madonna; Mirwais

Data should be: Madonna; Ahmadzaï, Mirwais

In all cases (for me), the names are separated by a semi-colon (;). Is there a way for the script to look to the semi-colon as the name separator and only swap first/last within that boundary?

Thanks for your help in sorting through the RegExp logic on this.

Post Reply