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

davidbspalding
Posts: 222
Joined: Fri Jan 08, 2010 3:53 pm
Location: Durham, NC

Re: RegExp Find & Replace 4.0 w/ 207 presets (2010-05-21)[MM2+3]

Post by davidbspalding »

I'm not sure why we have the Move files to <Genre>\<Artist>\<Album>\<Track#> - <Title>.ext preset ... MM has a great Auto-Organize feature which supports strings like "..\<genre>\<artist>\<album>\<track#> - <title>" ?

Or was that for users of MM2 (which I haven't used, so I'm not familiar with the feature set)?
___________________

Apologies if this is evident from utilizing two presets in serial.... I searched the the thread and couldn't find this use case.

I want to populate the Lyrics field with the contents of the Composer field surrounded by "(" and ")" characters. Currently I have a few lyrics which appear like so
I'm not in love, so don't forget it
It's just a silly phase I'm going through...
I'd like to populate Lyrics which DON'T have composers with Composer like so
(D. Gamble; G. Gouldman; R.L. Martin)

I'm not in love, so don't forget it
It's just a silly phase I'm going through...
I may also want to delete the first line of the Lyrics which already have (inaccurate) composer info and then rewrite with the correct values which WMPlayer downloaded from AMG. I think existing presets would do that just fine (search and delete first line up to and including first \n).

Any suggestions welcome. (Including how to craft a RegExp or VBasic string from scratch. ;) )
«Tell me and I'll forget; show me and I may remember; involve me and I'll understand.» Chinese proverb
T43 XP-SP3 2GB RAM, dual hard drives, MM 4.0.3 Gold; Ipod Classic 7G v2.0.4, Nano 3G v1.1.3.
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 4.0 w/ 207 presets (2010-05-21)[MM2+3]

Post by ZvezdanD »

You sent me a PM, but you have disabled their receipt and I cannot answer you in PM, so there is my answer here.
davidbspalding wrote:Regexp find & replace 4.0.3

Preset name misspelling:

Exctract Album Artist from last folder of Path (e.g. ..\Album artist - Album\Title.mp3)

change to

Extract Album Artist from last folder of Path (e.g. ..\Album artist - Album\Title.mp3)

Keep on truckin', this is a superb plugin! :)
Actually, this preset name is already fixed in 4.0.3. You probably have installed both presets now. Thanks for the report anyway :)

By the way, I think that I already told this, but I will repeat. My suggestion with installation (especially after I change something drastically with them or if I have added many new ones) is to first make a backup of presets with old version, remove all presets using Export/Import dialog, and then install new version of add-on. After you finish with installation you could import back your own created presets. This is because from time to time I improve some existing presets, but keep their names intact and since this add-on during installation checks only their names, it will skip installation of such improved presets.
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
davidbspalding
Posts: 222
Joined: Fri Jan 08, 2010 3:53 pm
Location: Durham, NC

Re: RegExp Find & Replace 4.0 w/ 207 presets (2010-05-21)[MM2+3]

Post by davidbspalding »

Ah, thanks for the reminder, I didn't do that. Will do so now..... I didn't have any customized settings, so the "upgrade" asked about adding new ones to existing presets and I accepted that.
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 4.0 w/ 207 presets (2010-05-21)[MM2+3]

Post by ZvezdanD »

davidbspalding wrote:I'm not sure why we have the Move files to <Genre>\<Artist>\<Album>\<Track#> - <Title>.ext preset ... MM has a great Auto-Organize feature which supports strings like "..\<genre>\<artist>\<album>\<track#> - <title>" ?
If you don't like some preset, you could remove it easily. In my opinion, it is much better if there are many presets, even if you don't need them all, then to have their limited number.

The mentioned preset is just simple example how someone could rename/move files according to existing tags, similar to built-in Auto-Organize option. Yes, that option is great, however there are many things that you cannot do with it, but you could do with this add-on. For example, you could take a look at "Append weighted average Bitrate of album to the last folder of Path" or "Add "Disc #" as last folder only if some song from album has Disc number >= 2" or many other similar presets which cannot be simulated with Auto-Organize option.
davidbspalding wrote:I want to populate the Lyrics field with the contents of the Composer field surrounded by "(" and ")" characters. Currently I have a few lyrics which appear like so
I'm not in love, so don't forget it
It's just a silly phase I'm going through...
I'd like to populate Lyrics which DON'T have composers with Composer like so
(D. Gamble; G. Gouldman; R.L. Martin)

I'm not in love, so don't forget it
It's just a silly phase I'm going through...
Well, If you want to add something to Lyrics, I think it should be Lyricist, not Composer. Anyway:
Find what: ^
Into: Lyrics
Regular expression 1: checked
Replace with: IIf(Len("$_") > 0 And Len(oSongData.Author) > 0 And Left("$_", Len(oSongData.Author) + 2) <> "(" & oSongData.Author & ")", "(" & oSongData.Author & ")" & vbNewLine & vbNewLine, "")
VBScript expression: checked
davidbspalding wrote:I may also want to delete the first line of the Lyrics which already have (inaccurate) composer info
Find what: ^\(.*?\)(\r\n)+
Into: Lyrics
Regular expression 1: checked
Replace with: empty
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
davidbspalding
Posts: 222
Joined: Fri Jan 08, 2010 3:53 pm
Location: Durham, NC

Re: RegExp Find & Replace 4.0 w/ 207 presets (2010-05-21)[MM2+3]

Post by davidbspalding »

ZvezdanD wrote:
davidbspalding wrote:... I want to populate the Lyrics field with the contents of the Composer field surrounded by "(" and ")" characters. Currently I have a few lyrics which appear like so
I'm not in love, so don't forget it
It's just a silly phase I'm going through...
I'd like to populate Lyrics which DON'T have composers with Composer like so
(D. Gamble; G. Gouldman; R.L. Martin)

I'm not in love, so don't forget it
It's just a silly phase I'm going through...
Well, If you want to add something to Lyrics, I think it should be Lyricist, not Composer. Anyway:
Find what: ^
Into: Lyrics
Regular expression 1: checked
Replace with: IIf(Len("$_") > 0 And Len(oSongData.Author) > 0 And Left("$_", Len(oSongData.Author) + 2) <> "(" & oSongData.Author & ")", "(" & oSongData.Author & ")" & vbNewLine & vbNewLine, "")
VBScript expression: checked
Beautiful, and it can be easily modified to use the Lyricist tag should that be populated (oSongData.Lyricist).[1] And learning some new features of your plug-in. Many thanks. :)

[1] I may start looking into using this to populate the Lyricist tag....
«Tell me and I'll forget; show me and I may remember; involve me and I'll understand.» Chinese proverb
T43 XP-SP3 2GB RAM, dual hard drives, MM 4.0.3 Gold; Ipod Classic 7G v2.0.4, Nano 3G v1.1.3.
davidbspalding
Posts: 222
Joined: Fri Jan 08, 2010 3:53 pm
Location: Durham, NC

Re: RegExp Find & Replace 4.0 w/ 207 presets (2010-05-21)[MM2+3]

Post by davidbspalding »

I couldn't find a post or image listing all 60+ icons available for display of presets on the toolbar, is one available?
«Tell me and I'll forget; show me and I may remember; involve me and I'll understand.» Chinese proverb
T43 XP-SP3 2GB RAM, dual hard drives, MM 4.0.3 Gold; Ipod Classic 7G v2.0.4, Nano 3G v1.1.3.
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 4.0 w/ 207 presets (2010-05-21)[MM2+3]

Post by ZvezdanD »

davidbspalding wrote:I couldn't find a post or image listing all 60+ icons available for display of presets on the toolbar, is one available?
http://www.mediamonkey.com/wiki/index.p ... rces#Icons
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
Spades68
Posts: 10
Joined: Sat Jun 05, 2010 2:20 pm

RegExp script help?

Post by Spades68 »

Filename: 04-drowning_pool-reborn.mp3

That is the problem, I've got plenty of tracks like that and I need to fix them.

What Needs to be Done

1.) Removal of "_ and -"
2.) Capitalize main words (maybe there's already a script for that)
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp script help?

Post by ZvezdanD »

Spades68 wrote:1.) Removal of "_ and -"
Choose the "Replace specified string with another one in <Into Field>..." preset.
Spades68 wrote:2.) Capitalize main words (maybe there's already a script for that)
Choose the "Capitalize <Into Field> (ASCII, Latin-1, Latin-2 & Cyrillic)..." preset.

If you are using Edit / Tag Manipulation Presets menu, you should specify Filename in the Destination field dropdown list when you get the preset's dialog box. If you are using the RegExp Find and Replace dialog box, you should specify Filename in the Into dropdown list.
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
dollarxgeneral
Posts: 3
Joined: Sat Dec 19, 2009 1:36 am

Re: RegExp Find & Replace 4.0 w/ 207 presets (2010-05-21)[MM2+3]

Post by dollarxgeneral »

I'm trying to get an expression that is mostly like the "Assign Genre if it is different from value assigned to most tracks from same album" expression but instead of the album I want it to be the artist.

For example, I have artists with sometimes multiple genres that I want to consolidate to the same genre that have several different albums/soundtracks/compilations.
I may have an artist with the genre "Indie Rock" on the studio albums but there might be a soundtrack that they're on that's still labeled "soundtrack" as the genre. I want to take the genre that is most prevalent in the artist and assign it to all tracks.

Another awesome thing would be if it could exclude certain genres from being renamed because some of the artists I have multiple genres on purpose.

I would do it manually but I have 39,000 tracks, 4,000 artists, and 55 genres so it would take forever to do it manually.
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 4.0 w/ 207 presets (2010-05-21)[MM2+3]

Post by ZvezdanD »

dollarxgeneral wrote:I'm trying to get an expression that is mostly like the "Assign Genre if it is different from value assigned to most tracks from same album" expression but instead of the album I want it to be the artist.
You could try the next Replace with string:

Code: Select all

IfNull(SQLQuery("SELECT Genre, Count(Genre) AS SortField FROM Songs WHERE Artist = '" & Replace(oSongData.ArtistName, "'", "''") & "' AND Genre <> '' GROUP BY Genre ORDER BY SortField DESC"), "$&")
dollarxgeneral wrote:Another awesome thing would be if it could exclude certain genres from being renamed because some of the artists I have multiple genres on purpose.
I am not sure that understand that requirement. If you want to exclude some specific genre from renaming, e.g. Rock, you could use something like this:

Code: Select all

IIf(oSongData.Genre = 'Rock', "$&", IfNull(SQLQuery("SELECT Genre, Count(Genre) AS SortField FROM Songs WHERE Artist = '" & Replace(oSongData.ArtistName, "'", "''") & "' AND Genre <> '' GROUP BY Genre 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
panzerq242

Re: RegExp Find & Replace 4.0 w/ 207 presets (2010-05-21)[MM2+3]

Post by panzerq242 »

Would it be possible to make a mask to leave the first genre in the "Genre" field but move the rest to the "Grouping" field?
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 4.0 w/ 207 presets (2010-05-21)[MM2+3]

Post by ZvezdanD »

panzerq242 wrote:Would it be possible to make a mask to leave the first genre in the "Genre" field but move the rest to the "Grouping" field?
Yes, but only with two presets. The first one is to move the rest to the "Grouping" field:
Find what: ^.*
Into: Grouping
Regular expression 1: checked
Replace with: RegExpEx(oSongData.Genre, ";\s?(.*)$", 0, 0)
VBScript expression: checked

The predefined preset "Remove all items from multi-item <Into Field> except first one..." could be used to leave the first genre in the "Genre" field - just specify Genre as the Into (Destination) field.
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
UncleBoarder
Posts: 20
Joined: Sun Feb 26, 2006 1:30 am

Re: RegExp Find & Replace 2.2.2 - with 50 presets [MM2+3]

Post by UncleBoarder »

Replacing the content of the path field doesn't work if the new path is a cname...
ZvezdanD wrote:
Okram wrote:I only have one suggestion: on folders it doesn't actually replace them but it creates new folders. It would be useful if, when renaming, it would also delete emptied (old) folders at the same time.
Sorry, but this is not its purpose. All it should do is to replace content of the Path field, remaining job is internal to MediaMonkey itself. So, I think you should report this to the Bug or Wishlist forum of MM.
[/quote]

My library knows my files as //10.0.0.91/Storage/Music....

I want to change them to //NAS/Storage/Music....

Since this is not actually moving the files, it's just a host name to the same location, MM complains. "An error occurred moving file //10.0.0.91/Storage/Music...."

I assume this is occurring because it's trying to write a file where one already exists? Anyway, as you say, this should just replace the content of the Path field. So why is it checking anything? Can it be set to just change the path without checking? Let it trust me.... I know where my files are. :wink:
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Re: RegExp Find & Replace 2.2.2 - with 50 presets [MM2+3]

Post by ZvezdanD »

UncleBoarder wrote:I assume this is occurring because it's trying to write a file where one already exists? Anyway, as you say, this should just replace the content of the Path field. So why is it checking anything? Can it be set to just change the path without checking?
Well, it is not my add-on which moves and checks the files during the Path modification, but it is the program itself. However, I have one another suggestion - you could try to change the database content directly using the SQL's UPDATE command. You could use Bex's SQL Viewer add-on or some SQLite specific software like SQLiteSpy to execute that command. Here is the SQL command for your case:

Code: Select all

UPDATE Songs SET SongPath = Replace(SongPath, '//10.0.0.91/', '//NAS/')
I strongly suggest making a backup of the database file first.
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
Post Reply