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

todobuena
Posts: 8
Joined: Sat Oct 17, 2009 11:13 am

important and easy improvement to regexp

Post by todobuena »

hello,
your scripts are awesome - thanks a lot...

i was wondering if it would be easy to implement alphabetical order in (one of the ) the regexp dropdownlists. so the users could define prefixes such as #+- in the names of the expressions. than we dont have the problem of finding the searched or used expressions and it would make navigation far more easy.
it would also be possible to order the list by other words like replace - rating - artist - delete
if used as prefixes.

the navigation and finding of expressions is often a horror-...

i already saw your todo of making hirachical structures - they are really needed - i hope you find time soon...
maybe you can spare some time or preimplement alphabetical order with prefixes.

all the best and thanks for your great work...
k.r. emanuel
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Re: important and easy improvement to regexp

Post by ZvezdanD »

todobuena wrote:i was wondering if it would be easy to implement alphabetical order in (one of the ) the regexp dropdownlists.
You could already sort the presets alphabetically - just open the RegExp Export/Import dialog box and click on the table header. After that the new order would be the same in all preset lists (in the Tag Manipulation Presets menu, the Presets combo box in RegExp Find & Replace dialog box and the Export/Import table). However, this action cannot be reversed since the presets would be rearranged in the .ini file, so it is recommended that you first export the presets if you decide to undo 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
todobuena
Posts: 8
Joined: Sat Oct 17, 2009 11:13 am

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

Post by todobuena »

thanks alot for the hint - this helps me al lot for the moment, now its easier to sort and find -

looking forward to further updates from this genial script... thanks for the work
steviegt
Posts: 311
Joined: Tue Mar 17, 2009 8:39 am

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

Post by steviegt »

1. After positioning the presets to my liking and then exporting, is there a way to have the presets be in the customized order when I import them instead of having them default at the bottom of the list?

2. Is there an easier way to move a preset to the top of the list other than using the up/down process?
MMW Gold Lifetime v4.1.21.11875
MM Pro Android v1.3.2.0824
Windows Home 10.0.17134.228 64-bit Build 1803
MS Edge


Next to MediaMonkey, the best program available: Total Commander http://www.ghisler.com/

"Being mean to someone takes more effort than being nice to them"
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 »

steviegt wrote:1. After positioning the presets to my liking and then exporting, is there a way to have the presets be in the customized order when I import them instead of having them default at the bottom of the list?

2. Is there an easier way to move a preset to the top of the list other than using the up/down process?
Sorry, the answer is "no" to the both questions.

EDIT: Here is one relatively easy way to place all your own sorted presets into the begin of the preset list:
1. open RegExp Export/Import dialog box;
2. select only your own presets and export them into one .ini file (if you didn't already do that);
3. select all presets and export them into another .ini file;
4. with still selected all presets, click on the Del button and confirm deleting of presets;
5. choose File option, specify the first saved .ini file with your own presets and import them;
6. specify the second .ini file with all presets and import them (your own presets would be included in the second .ini file as well, but they would not be imported twice because the add-on checks each preset if it already exists in the 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
steviegt
Posts: 311
Joined: Tue Mar 17, 2009 8:39 am

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

Post by steviegt »

Worked great. Thank you.
MMW Gold Lifetime v4.1.21.11875
MM Pro Android v1.3.2.0824
Windows Home 10.0.17134.228 64-bit Build 1803
MS Edge


Next to MediaMonkey, the best program available: Total Commander http://www.ghisler.com/

"Being mean to someone takes more effort than being nice to them"
Newbie

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

Post by Newbie »

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
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 »

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
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
tooone7
Posts: 39
Joined: Tue Jan 04, 2011 7:17 am

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

Post by tooone7 »

Hey ZvezdanD, this is an excellent script! Thank you very much for all the effort

you put into this!

I just have a question, I want to search my Series' filenames for Season/Episode

numbers.

I have the following regex: (.+)(s)?(\d{1,2})([ex])?(\d\d)(.+)?

I intend to run this script 2 times, one to put $3 (the Season number) in the replace field and the second time to put $5 (the Episode number) in the replace field

So I put this regex in the "Find what" field and tick the "Reglar Expression 1"

checkbox, and in the replace I want to put $3, which would be the Season number

in this case.

Now my question is, how do I run the "Find" part on the filename and then the

"Replacement" on the Episode# field?

The way I understand it is that I need to put Episode# in the Into field and Path

or filename in the From field. But this does not work at all... so I guess my understanding is not right :)

I hope you can shed some light on this for me please :)

Here is a quick demo of some filenames and what I want them to look like afterwards (sorry the tables aren't displaying very nicely :( ):

BEFORE:

Filename | Episode# Tag | Season# Tag
-----------------------------------------------------------------
burnnotice101.avi | |
burnnotice102.avi | |
burnnotice103.avi | |

AFTER:

Filename | Episode# Tag | Season# Tag
-----------------------------------------------------------------
burnnotice101.avi | 1 | 1
burnnotice102.avi | 2 | 1
burnnotice103.avi | 3 | 1

I am using MM4 (if that makes a difference) :)

Here is 2 screenshots of what I mean:
This is where it kind of works, but is replacing on the same field:
Image

http://www.freeimagehosting.net/474b4


Here is where I think I am understanding it wrong.. I dont know :P Please have a look :)
Image

http://www.freeimagehosting.net/81b80

EDIT: Images didn't display with [ img ] code so I pasted the links...
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 »

tooone7 wrote:how do I run the "Find" part on the filename and then the

"Replacement" on the Episode# field?

The way I understand it is that I need to put Episode# in the Into field and Path

or filename in the From field. But this does not work at all...
You are right, Episode# should be selected for Into field and Path or Filename for From field. However, your Regex string should not be specified in the Find what field, but inside of the Replace with string:
Find what: ^.*
Into: Episode#
Regular expression 1: checked
Replace with: RegExpEx(<From Field>, "(.+)(s)?(\d{1,2})([ex])?(\d\d)(.+)?", 0, 5)
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.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
tooone7
Posts: 39
Joined: Tue Jan 04, 2011 7:17 am

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

Post by tooone7 »

Thank you so much ZvezdanD. :D

A very quick replay and that works excellent!

Now I can finally start organizing my videos :)

EDIT: I'm confused about the whole VBScript thing, can you perhaps point me to a short tutorial on how to use it in conjunction with your script? I would really like to learn some more, because it is a very powerful script you have here :)

EDIT again: 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#?

Because I now have RegExpEx(<From Field>, "(.+)(s)?(\d{1,2})([ex])?(\d\d)(.+)?", 0, 4) for the Episode# and RegExpEx(<From Field>, "(.+)(s)?(\d{1,2})([ex])?(\d\d)(.+)?", 0, 2) for the Season#. (Note the last argument for the RegExpEx() function differs, that's all. And of course the Into field changes aswell..
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 »

Is there a way to mark certain presets as, say favorites, so one doesn't have to scroll through the list every time to find the ones they use most?

Edit: I tried to delete this but the board won't let me. After rereading the first post I see you can turn on a toolbar button for the preset you want so that answers my question.
Last edited by Vyper on Sat Oct 15, 2011 5:15 am, edited 1 time in total.
Stop Button Freak
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 »

tooone7 wrote:I'm confused about the whole VBScript thing, can you perhaps point me to a short tutorial on how to use it in conjunction with your script? I would really like to learn some more
First of all, you could click on the ? button at the bottom-left corner of the dialog box and you would get a short reference for the regular expressions as well as for some custom made VBScript functions. If you don't know VBScript programming language, there are some on-line tutorials about it, for example http://www.w3schools.com/vbscript/default.asp and http://msdn.microsoft.com/en-us/library ... 85%29.aspx. You could also use MediaMonkey API with a reference at http://www.mediamonkey.com/wiki/index.p ... on_objects, but you need to know about object oriented programming for that.
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. I have a note about it in the ToDo section of the first post.

By the way, I think that you could get the same result for your requirement without using VBScript expression:
Find what: ^.*
Into: Season#
Regular expression 1: checked
Replace with: \d{1,2}(?=[ex]?\d\d.*$)
From: Filename
Regular expression 2: checked

For Episode you could try the next Replace with string: \d\d(?=.*$) However, the preset with VBScript expression is more reliable since it checks if the season/episode number is preceded with s or [ex], so you could not get the wrong result with the file names containing numbers that not represent season/episode. Unfortunately, Regular expressions built in the VBScript doesn't support Lookbehind which is necessary for something like that. For example, in some programing languages you could write (?<=[ex]?)\d\d(?:.*) where (?<=...) is replacement for any preceding string that should not be included into the result.
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
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 »

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?
Stop Button Freak
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 »

Vyper wrote:Is there a way to mark certain presets as, say favorites, so one doesn't have to scroll through the list every time to find the ones they use most?

Edit: I tried to delete this but the board won't let me. After rereading the first post I see you can turn on a toolbar button for the preset you want so that answers my question.
Yeah, you could turn on a toolbar button for most used presets or you could move them to the begin of the preset list to have easier access to them. I have posted a description about it on this or previous page.
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