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

lapillus
Posts: 4
Joined: Thu Dec 01, 2011 10:30 pm

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

Post by lapillus »

Thanks for the VERY useful script!

Among the presets I particularly appreciate one that removes the artist from the genre and was wondering what the code would be to do the same for the title and the album. Any help would be appreciated!
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 »

lapillus wrote:Among the presets I particularly appreciate one that removes the artist from the genre and was wondering what the code would be to do the same for the title and the album.
You should be more specific what exactly you want with some examples of your current title/album. Do you have artist at the begin of the title/album or on the end or in the middle, what is a separator between them...? If you have the album name like "Artist - Album" you could use the "Remove Artist name and " - " or "-" from the begin of <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
lapillus
Posts: 4
Joined: Thu Dec 01, 2011 10:30 pm

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

Post by lapillus »

ZvezdanD wrote:
lapillus wrote:Among the presets I particularly appreciate one that removes the artist from the genre and was wondering what the code would be to do the same for the title and the album.
You should be more specific what exactly you want with some examples of your current title/album. Do you have artist at the begin of the title/album or on the end or in the middle, what is a separator between them...? If you have the album name like "Artist - Album" you could use the "Remove Artist name and " - " or "-" from the begin of <Into Field>..." preset.
Sorry, I meant remove the Artist and the Album that have been added to the list of genres by the GenreFinder Extension. They're just regular genres, no easily spotted punctuation, unfortunately. Some folks on LastFM don't seem to get that you don't need to tag those sorts of things and with a library of about 20,000 titles weeding them out is proving to be a huge pain.
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 »

lapillus wrote:I meant remove the Artist and the Album that have been added to the list of genres by the GenreFinder Extension.
Again, you are not giving any examples. I cannot write the preset if I don't know how exactly looks your Genre and Album tag.

Anyway, maybe you could try the next two presets:
Preset: Remove <From Field> item from multi-item <Into Field>...
Description: The Beatles (Artist) and Rock; The Beatles; Pop/Rock (Genre) -> Rock; Pop/Rock (Genre)
Find what: ^.+
Into: whatever, e.g. Genre
Regular expression 1: checked
Replace with: IIf(Len(<From Field>) > 0, LTrim(Mid(RegSub(";$&", ";\s?(" & RegSub(RegSub(<From Field>, "([^;\w])", "\$1"), ";\s?", "|") & ")", ""), 2)), "$&")
From (<<): whatever, e.g. Album
VBScript expression: checked

Preset: Clear <Into Field> if it is equal to <From Field>...
Description: The Beatles (Artist) and The Beatles (Genre) -> (empty Genre)
Find what: ^.+
Into: whatever, e.g. Genre
Regular expression 1: checked
Replace with: IIf(Len(<From Field>) > 0 And <From Field> = "$&","", "$&")
From (<<): whatever, e.g. Album
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
AshwinP
Posts: 4
Joined: Thu Dec 22, 2011 5:07 pm

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

Post by AshwinP »

Hi,

Need some help... I did a search on my library for a string that got 2 tracks in the resut. however when I tried to to a find and replace using this tool, I am not able to find that string in any of the tags... I tried searching in individual tag fields and also in All Test fields, but couldn't find the string any where...

How is it then that the MM search feature is able to find tracks with a string, but the same is not found when using this tool...

regards,
Ashwin.
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 »

AshwinP wrote:How is it then that the MM search feature is able to find tracks with a string, but the same is not found when using this tool...
- What is your version of the program and this add-on?
- Did you select all tracks from the Library before you entered the RegExp Find & Replace dialog box?
- What is your settings in the mentioned dialog box? Could you post its screenshot?
- What is your string that you are looking for?
- Did you have selected the field which contains that string in the Options dialog box > Library/Search sheet (relevant only if you choose All Text Fields)?
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
AshwinP
Posts: 4
Joined: Thu Dec 22, 2011 5:07 pm

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

Post by AshwinP »

Hi,

Thanks for the quick response...
- What is your version of the program and this add-on?
- Did you select all tracks from the Library before you entered the RegExp Find & Replace dialog box?
- What is your settings in the mentioned dialog box? Could you post its screenshot?
- What is your string that you are looking for?
- Did you have selected the field which contains that string in the Options dialog box > Library/Search sheet (relevant only if you choose All Text Fields)?
I am using the latest versions of both MM and the regEx tool
Yes, I did select all the tracks
Did not get the last question, where can I find this option?
The string I am looking for is http://www.songs.pk
Here's the screen shot for more details...
http://www.freeimagehosting.net/f9a00
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 »

AshwinP wrote:
- Did you have selected the field which contains that string in the Options dialog box > Library/Search sheet (relevant only if you choose All Text Fields)?
Did not get the last question, where can I find this option?
Options dialog box > Library/Search sheet.

I cannot see from the screenshot that any field contains the mentioned string. Are you absolutely sure that the selected tracks contain it? Maybe your search result in the program is wrong.
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
AshwinP
Posts: 4
Joined: Thu Dec 22, 2011 5:07 pm

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

Post by AshwinP »

Well, you must have noticed in the screen shot the search string is exactly the same... I am looking to seach for www.songs.pk first in the main library, then I am trying to remove it for all the selected tracks.

Funny thing is that, I am also not able to find it any of the properties/tags. So, question is if the string really isnt there, then why is MM search showing me the results...?

If there is a way I can send you a track and you can try it for yourself.
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 »

AshwinP wrote:So, question is if the string really isnt there, then why is MM search showing me the results...?
Maybe MM search function has a bug?
AshwinP wrote:If there is a way I can send you a track and you can try it for yourself.
You could upload it to some file server like Mediafire and post me the link using PM.

EDIT: Maybe you could try to enclose the mentioned string inside of double quotes when using MM search option (http://www.mediamonkey.com/wiki/index.p ... Search/4.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
AshwinP
Posts: 4
Joined: Thu Dec 22, 2011 5:07 pm

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

Post by AshwinP »

Ok, just found out that there are some fields like 'Comments' and 'Subtitle' that are missing in MM, I noticed that these are filled with the String I am looking for... but again, the question is if these fields are omitted in MM, why is a search on the track in MM showing results (Bug???)... Must have to do something with the ID3 tag versions I guess, but I am no expert on it.

Can these 2 fields also be added as Text fields to the ReqEx tool??? That should resolve part of the problem.
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 »

AshwinP wrote:the question is if these fields are omitted in MM, why is a search on the track in MM showing results (Bug???)...
Well, if you don't have those fields selected in the Options dialog box, but MM is still finding the mentioned string in those fields, then it is a MM bug.
AshwinP wrote:Can these 2 fields also be added as Text fields to the ReqEx tool???
I told you already: open the Options dialog box > Library/Search sheet and select fields that you want to search for using All Text Fields. Or just specify Comment in the Into list of the RegExp dialog. The Subtitle is not available for searching using this add-on, but neither with the MM search option. BTW, try also my previous suggestion with double quotes when using MM search option.
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 »

Thanks ZvezdanD. It a late thank you, but THANKS, really appreciate it. Manage to get the script to work. But I got another request that need your help. Below is what I asked, and what you told me to use;

Code: Select all

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
Question: Is it possible to Copy all Artist of the track then add them (cumulative) to Album Artist?

I hate having Album Artist as "Various Artist"
So I tend to copy the Artist of each track, listing them in order from Track 1>Infinity. So to further expand the question, is that possible?

For example:
Track: 1, Artist: A, Album Artist: A
Track: 2, Artist: B, Album Artist: A
Track: 3, Artist: C, Album Artist: A
(RegExp Find & Replace)
Track: 1, Artist: A, Album Artist: A;B;C
Track: 2, Artist: B, Album Artist: A;B;C
Track: 3, Artist: C, Album Artist: A;B;C

What I want to ask for is, it is possible to have it not in Alphabetic order but in order of 'Appearance'?
E.g.
Track 1 - Artist B
Track 2 - Artist A
Track 3 - Artist C
(RegExp Find & Replace)
Track: 1, Artist: A, Album Artist: B;A;C
Track: 2, Artist: B, Album Artist: B;A;C
Track: 3, Artist: C, Album Artist: B;A;C
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:What I want to ask for is, it is possible to have it not in Alphabetic order but in order of 'Appearance'?
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))")
If you want to get them sorted by adding order then replace CAST(Songs.TrackNumber AS int) with Songs.ID or Songs.DateAdded. Although, I don't understand why you need such format when alphabetic order is more natural.
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
lobojon
Posts: 45
Joined: Sun Nov 02, 2008 11:02 pm

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

Post by lobojon »

Switching from Extract Fields because of upgrade to MM4. I have no choice apparently.

So, now I have to learn how to use this powerful script. No worries, but oh so short term depressing for me.

I have the bunch of files with the following information in ONE field : 02 artist name ¤ song title.

I need to extract the track# to the proper field and eliminate the leading 0
I need to replace the ¤ character with a "-" so that I can...
Split artist and title into their respective fields

I used to use a combo of the MM Ctrl T/Q functions, Mp3tag, and the Extract Fields script and then the Leading 0s script to solve this problem. Perhaps it was not so efficient, but it worked for me. Of course, I am a complete noob and winging it while using these scripts and program functions. However, I am still able to solve most of my problems

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? I continue to troll the forum as usual since I am not the first person to encounter this paradigm shift from MM3 to MM4 and a limited skill set.

Willing and able to be retrained.
MM Lifer since 2008. Still apprentice (noob) level.
Windows 7 Ultimate 64bit
Toshiba Satellite laptop
Music collection of 2 TB located on an external hard
Spybot Search & Destroy / Iobit Anti Malware
Avast Antivirus Free Edition

I love the Monkey and the forum.
Thanks to all who provide advice, assistance, add ons and scripts. It is very much appreciated!
Post Reply