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

Beggar

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

Post by Beggar »

My wording is bad, sorry. I try to give another example. I tried testing the new "String" but I can't work out how it work. Anyway you were partly right about sorting it in "Track #"
Let say this is the format I used; <Track #>. <Title> (<Artist>)
01. Monkey (Smile;Flower)
02. Bird (Cat;Cow)
03. Smoke (Smile)

What I want is, the Album Artist to appear like this; (Smile;Flower;Cat;Cow), since Track #1 Smile is the first singer.
The reason for this is, I don't use something like;
01. Monkey feat. Flower (Smile)
Since Smile is the main 'star' of this Album, naturally he/she would be the first person on Album Artist; everyone else is just support, guest star, or less significant.
My Auto-organizing format is as follow;
\$First<Album Artist>\<Album>\<Track #>. <Title>

As you can see in the '$First<Album Artist>', this should create a folder for Smile, not Flower/Cat or Cow. They not important as Smile.

Hope that more understandable. Thank you for your time and help.
ZvezdanD wrote: I don't know what you mean by "Appearance". If you want to get artists ordered by Track #, then you could use this Replace with string:

Code: Select all

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 & " ORDER BY CAST(Songs.TrackNumber AS int))")
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 »

lobojon wrote:I am trying to discover the process in RegExp Find and Replace in order to accomplish the above task. Can anyone help me find the topic/thread/instructions/etc to understand and perform this operation?
Firstly, you should read the first post of this thread, then you should take a good look at all included presets (in the first post or in the RegExp list). There is the Usage section of the first post, so I don't want to repeat something that is already there. I will tell you just general guidance with the names of presets, you could find them in the Edit > Tags Manipulation Presets menu...
I have the bunch of files with the following information in ONE field : 02 artist name ¤ song title.
You didn't say which is that ONE field, so I would use that name as such.
I need to extract the track# to the proper field
Preset: Assign specified number of characters from the middle of <From Field> to <Into Field>...
Source: ONE field
Dest: Track#
Start position: 1
Characters to copy: 2
and eliminate the leading 0
Preset: Remove leading zeroes from Track number
I need to replace the ¤ character with a "-" so that I can...
Split artist and title into their respective fields
1. Preset: Replace specified string with another one in <Into Field>...
Dest: ONE field
String to replace: ¤
Replace with: -

2. Preset: Remove all digits from the begin of <Into Field>...
Dest: ONE field

or
Preset: Remove specified number of characters from the begin of <Into Field>...
Dest: ONE field
Num. of characters: 3

3. Preset: Assign the begin of <From Field> before "" - "" to <Into Field>...
Source: ONE field
Dest: Artist

4. Preset: Assign the end of <From Field> after specified string to <Into Field> (only if exists)...
Source: ONE field
Dest: Title
Separator: - (which is the dash with spaces around it, i.e. " - ")

Well, you don't need the 1st preset which replace ¤ character with a "-" if you specify that character in the 4th preset and if you use "Assign the begin of <From Field> before specified string to <Into Field>..." with the same separator string instead of the 3rd preset. Actually, such solution would be even better because with the " - " as a separator you would get into trouble with the titles that contain that 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
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 »

Beggar wrote:I tried testing the new "String" but I can't work out how it work.
You should be more specific about what you tried. Did you keep the same preset settings as with the first preset except the Replace with string?
Beggar wrote:Since Smile is the main 'star' of this Album, naturally he/she would be the first person on Album Artist
I have many Various Artists albums where the first songs are not the best from those albums, nor are their artists.
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
Beggar

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

Post by Beggar »

ZvezdanD wrote:
Beggar wrote:I tried testing the new "String" but I can't work out how it work.
You should be more specific about what you tried. Did you keep the same preset settings as with the first preset except the Replace with string?
Let assume this is what the album look like;
<Track #>. <Title> (<Artist>)
01. Monkey (Smile;Flower)
02. Bird (Cat;Cow)
03. Smoke (Smile)

Well I tried the following Replace with

Code: Select all

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 & ")")
The string above will order it by Album Artist by Album Alphabetically (that might be confusing).
It did something like this; list all the album artist (Smile;Flower;Cat;Cow) then sort it alphabetically (Cat;Cow;Flower;Smile).

Code: Select all

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 & " ORDER BY CAST(Songs.TrackNumber AS int))")
I can't figure out this string but my guesses is that; it sort Album Artist by Album Alphabetically but by Singer that appear the most; e.g. Since Smile appear twice (Track #1 and #3) it will be like this; (Smile; Cat;Cow;Flower). This is just my guess, I can't figure out how this string work.

Code: Select all

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 & " ORDER BY Songs.ID)")
Same as above; I don't know how this one work. Tried looking for clues but the order just didn't give me any idea.

Code: Select all

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 & " ORDER BY Songs.DateAdded)")
Tried interchanging this with the one above and there seem to be no difference. However since one is Songs.DateAdded, my guess is it sort/order by the date which the Song/Track was added to Mediamonkey.
Beggar wrote: I have many Various Artists albums where the first songs are not the best from those albums, nor are their artists.
I guess this is a demographic issue. I could give some example of 'well known' (subjective) album which the first singer tend to be most important.

Beyonce's - 4 As you can see in Track #5 (Party); 5. "Party" (featuring André 3000). If I were to put Artist as Beyonce;Andre 3000, then use any of the above 4 Replace String, I will have Album Artist as Andre 3000;Beyonce, but Andre only sang 1 song, he is not important and (I assume) is a guest singer.

Alicia Keys- Song in A Minor
Disc 1
8. "Jane Doe" I have it as "Alicia Keys;Kandi Burruss" although Wikipedia is different
11. "Mr. Man" (featuring Jimmy Cozier)
Disc 2
1. "A Woman's Worth" (Remix featuring Nas)

Using any of the above Replace String I would either get;
Alicia Keys; Jimmy Cozier; Kandi Burruss; Nas
Nas; Kandi Burruss; Jimmy Cozier; Alicia Keys
Nas; Kandi Burruss; Jimmy Cozier; Alicia Keys
Nas; Kandi Burruss; Jimmy Cozier; Alicia Keys

The first one (Alicia Keys; Jimmy Cozier; Kandi Burruss; Nas) would almost be perfect except it should have been (Alicia Keys; Kandi Burruss; Jimmy Cozier; Nas) since he sang in Track #8 before Jimmy Cozier appear in Track #11.

Obviously this Album belong to Alicia Keys; everyone else was just guest singer or similar. The reason why one of the Replace String would work so well albeit Jimmy Cozier and Kandi Burruss order is because Alicia Keys name start with "A" otherwise it might not worked so well.

I hope that wasn't too long and understandable. Really appreciate it.
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 »

Beggar wrote:
ZvezdanD wrote:I have many Various Artists albums where the first songs are not the best from those albums, nor are their artists.
I guess this is a demographic issue. I could give some example of 'well known' (subjective) album which the first singer tend to be most important.

Beyonce's - 4

Alicia Keys- Song in A Minor
The mentioned albums are not the Various Artists albums in a classical sense, but albums from single artist with some featuring artists on some tracks. The true Various Artist album is something like e.g. "The Best from '60" where you could get one-hit wonder artist on the first track and some The Beatles song as the 10-th track on that album.
Beggar wrote:If I were to put Artist as Beyonce;Andre 3000, then use any of the above 4 Replace String, I will have Album Artist as Andre 3000;Beyonce
OK, try this and let me know if it is working as you want:

Code: Select all

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 & " ORDER BY CAST(Songs.TrackNumber AS int), InStr(Songs.Artist || ';', Artists.Artist || ';')")
However, you would get the unwanted result even with it if your main artist is not the first specified artist on the first track from the album.
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
Beggar

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

Post by Beggar »

ZvezdanD wrote: The mentioned albums are not the Various Artists albums in a classical sense, but albums from single artist with some featuring artists on some tracks. The true Various Artist album is something like e.g. "The Best from '60" where you could get one-hit wonder artist on the first track and some The Beatles song as the 10-th track on that album.
Those album I pick so that it could use as an example. If I use the album that I usually listen to you would have a hard time understanding due to language barrier and there isn't many information available on the internet with said album. There quite a few with album artist containing 10-20.
ZvezdanD wrote: OK, try this and let me know if it is working as you want:
It seem to be working. Thanks you.
theta_wave
Posts: 310
Joined: Fri Apr 13, 2007 12:54 am

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

Post by theta_wave »

Is it possible to swap contents within parenthesis within a field? For example:

Code: Select all

Song Title (x Mix) (feat. y) -> Song Title (feat. y) (x Mix)
or simply
Song Title (x) (y) -> Song Title (y) (x)
MM Gold Lifetime since 2.5.5.998
Computer: Lenovo Y580 System: Win7 Ultimate x64 SP1 / Arch Linux Mediamonkey 4: w/ Monkeyrok 5.6, Minilyrics 1.4b, iMonkey Skin
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 »

theta_wave wrote:Is it possible to swap contents within parenthesis within a field? For example:

Code: Select all

Song Title (x Mix) (feat. y) -> Song Title (feat. y) (x Mix)
or simply
Song Title (x) (y) -> Song Title (y) (x)
Find what: (.+\()(.*?)(\).*?\()(.*?)(\).*?)$
Regular expression 1: checked
Replace with: $1$4$3$2$5
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
theta_wave
Posts: 310
Joined: Fri Apr 13, 2007 12:54 am

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

Post by theta_wave »

ZvezdanD wrote:
theta_wave wrote:Is it possible to swap contents within parenthesis within a field? For example:

Code: Select all

Song Title (x Mix) (feat. y) -> Song Title (feat. y) (x Mix)
or simply
Song Title (x) (y) -> Song Title (y) (x)
Find what: (.+\()(.*?)(\).*?\()(.*?)(\).*?)$
Regular expression 1: checked
Replace with: $1$4$3$2$5
Thanks, it worked like a charm. :D
MM Gold Lifetime since 2.5.5.998
Computer: Lenovo Y580 System: Win7 Ultimate x64 SP1 / Arch Linux Mediamonkey 4: w/ Monkeyrok 5.6, Minilyrics 1.4b, iMonkey Skin
cranstantinople
Posts: 1
Joined: Tue Aug 30, 2011 11:03 pm

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

Post by cranstantinople »

Hello, this is a great script. I was just wondering how simple it would be for me to make a script that does many of your presets in a series (ie: Replace_WithSpace > Replace (... remix/version/edit ...) with [ ... ] at the end of Title > Move featuring artists or [(featuring artists)] from the end of Artist to the end of Title > ApplyCaplitalizationRules

Have you ever considered making a plug-in that "normalizes" mp3 tags? Maybe something with a more user-friendly interface that lets you decide in which field you want mixes and featuring artists to go and customize capitalization rules (ie. Feat. Ft. feat. ft. vs. Vs.). It's a feature that I would be willing to pay for.
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 »

cranstantinople wrote:I was just wondering how simple it would be for me to make a script that does many of your presets in a series (ie: Replace_WithSpace > Replace (... remix/version/edit ...) with [ ... ] at the end of Title > Move featuring artists or [(featuring artists)] from the end of Artist to the end of Title > ApplyCaplitalizationRules
I don't know what you mean by "a script" since many users call my presets as "scripts". As I said in the first post of this thread, the proper support for action groups which would execute multiple presets in batch is on my ToDo list and already is in progress, but I cannot predict when it would be finished.

If you are using 4.2 or newer version of this add-on you could create some preset which could execute two or more single presets at once and, more specifically, which could modify two or more fields at once. One such preset is supplied with the add-on: "Swap <From Field> and <Into Field>...", and some presets using this approach I have posted in the recent pages of this thread. However, I must say that such usage is not so simple, especially because it requires the careful specifying of double quotes, and it is recommended only for combinations of not-so-complex presets.
cranstantinople wrote:Have you ever considered making a plug-in that "normalizes" mp3 tags? Maybe something with a more user-friendly interface that lets you decide in which field you want mixes and featuring artists to go and customize capitalization rules (ie. Feat. Ft. feat. ft. vs. Vs.).
I am not sure that understand what you mean. The RegExp Find & Replace add-on already has a bunch of presets which could move/copy mixes and featuring artists to whichever field you decide. Also, its "Capitalize <Into Field> with exceptions ..." preset already has a possibility to specify capitalization rules - feat., vs and pres. are already included to be lowered. You could also customize the "Fix common words (featuring, presents, versus) in <Into Field>..." preset.
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
MMuser2011
Posts: 1308
Joined: Mon Oct 17, 2011 8:28 am
Location: Central Europe

Re:

Post by MMuser2011 »

FANTASTIC SCRIPT! Thank you very much! :D
Friedrich wrote:2. Am I wrong, or does the script not synchronize the tags?
May I ask again: Should the script write the modified tags automatically to the tracks or do I have to synchronize them by pressing CTRL-S (or Tools, Advanced Tag Management, Synchonize Tags)?
Magic Nodes v4.3.3 (2018-10-03) last free version SQL Viewer v2.4 (2009-10-25)
ExternalTools v1.4 (2011-05-09) iTunesMonkey 1.0 + Acoustid
Calculate Cover Size v1.7 (2012-10-23) RegExp Find & Replace v4.4.9 (2018-10-03) last free version
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Re: Re:

Post by ZvezdanD »

MMuser2011 wrote:Should the script write the modified tags automatically to the tracks or do I have to synchronize them by pressing CTRL-S (or Tools, Advanced Tag Management, Synchonize Tags)?
It depends of your "Update tags when editing properties" setting in the Options dialog box: if it is turned on, then tags are automatically written to the files.
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
BionicRooster
Posts: 18
Joined: Tue Jun 09, 2009 5:40 pm

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

Post by BionicRooster »

I need to delete the artist, the parentheses, and "Cover" from the title and place the artist in the Original Artist field.
This is what I want to achieve:

What I have now =

Title: Day Is Done (Nick Drake Cover)
Original Artist:

I want transformed into =

Title: Day Is Done
Original Artist: Nick Drake

I have been reading this thread, trying what I thought would work but I am stumped. Can anyone help?
Thanks,
Wayne
“Heart disease is a foodborne illness." Caldwell Esselstyn MD
BionicRooster
Posts: 18
Joined: Tue Jun 09, 2009 5:40 pm

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

Post by BionicRooster »

I finally figured it out on my own. It is a five step process. It goes like this...

Start with
Title: Day Is Done (Nick Drake Cover)
Original Artist:

1. Copy <Title> to <Original Artist>...
Title: Day Is Done (Nick Drake Cover)
Original Artist: Day Is Done (Nick Drake Cover)

2. Remove (...) or [...] from the end of <Title>...
Title: Day Is Done
Original Artist: Day Is Done (Nick Drake Cover)

3. Replace specified string with another one in <Original Artist>... (Replace " Cover)" with nothing in Original Artist)
Title: Day Is Done
Original Artist: Day Is Done (Nick Drake

4. Replace specified string with another one in <Original Artist>... (Replace " (" with " - " in Original Artist)
Title: Day Is Done
Original Artist: Day Is Done - Nick Drake

5. Remove the begin of <Into Field> before (and including) "-" or " - "...
Title: Day Is Done
Original Artist: Nick Drake

DONE
“Heart disease is a foodborne illness." Caldwell Esselstyn MD
Post Reply