Is there a way to batch rename the filename?

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

Teknojnky
Posts: 5537
Joined: Tue Sep 06, 2005 11:01 pm
Contact:

Re: Is there a way to batch rename the filename?

Post by Teknojnky »

steviegt wrote:No I don't know how to write VBScript/Regular expressions. What I need is something like:

C:\Users\Steve\Music\Chicago - The Best Of Chicago 40th Anniversary Edition [Disc 1] - 10 - (I've Been) Searchin' So Long.mp3

Is this what you meant?

Whats wrong with something like this auto-org mask:

Code: Select all

<album artist> - <album>$if(<disk#>, [Disc <disk#>]) - <track#:2> - <title>
There are also several examples @ http://www.mediamonkey.com/wiki/index.p ... s_Examples
Last edited by Teknojnky on Tue Apr 07, 2009 12:16 pm, edited 1 time in total.
steviegt
Posts: 311
Joined: Tue Mar 17, 2009 8:39 am

Re: Is there a way to batch rename the filename?

Post by steviegt »

:D You're brilliant. You made my day. Thanks! :D
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"
okram

Re: Is there a way to batch rename the filename?

Post by okram »

Hi, I have another question.

For a long time I'm searching for the solution to organize my folders in a way like ..\Album name (bitrate)\Track name.

I know with RegExp you can assign weighted average Bitrate of the album to the folder and this cannot be done with Auto-Organize. However after renaming ReqExp will not delete emptied folders, which makes it not really usable for me.

Therefore I was thinking of the following workaround - is it possible to make a preset or a script which would put average (and maybe min, max) bitrate into one of the custom fields? If yes, auto-organize can do the rest.

Thanks.
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Re: Is there a way to batch rename the filename?

Post by ZvezdanD »

okram wrote:However after renaming ReqExp will not delete emptied folders, which makes it not really usable for me.
Have you tried to turn on the "Delete emptied folders when moving files as a result of the Path modification" option?
okram wrote:is it possible to make a preset or a script which would put average (and maybe min, max) bitrate into one of the custom fields?
You already have two similar presets, "Assign the weighted average album's rating to the Custom 3 field" and mentioned "Assign the weighted average Bitrate of the album to the last folder of the Path", so you only need to combine them:
Find what:

Code: Select all

^.*
Into: Custom 1
Regular expression 1: checked
Replace with:

Code: Select all

Int(SQLQuery("SELECT Sum(Bitrate * SongLength) / Sum(SongLength) FROM Songs WHERE IDAlbum = " & oSongData.Album.ID & " GROUP BY IDAlbum") / 1000)
VBScript expression: checked

If you want Min, you should replace Sum(Bitrate * SongLength) / Sum(SongLength) with Min(Bitrate).
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: Is there a way to batch rename the filename?

Post by steviegt »

I want to save the script option that was created for me? How do I make this a saved option so I don't have to copy & paste every time I want to use it? I clicked on "New" and filled in all the blanks but "Save" never lit up and became availabe (an active button).
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: Is there a way to batch rename the filename?

Post by ZvezdanD »

You should enter some name to the preset, e.g. "Assign the weighted average Bitrate of the album to the Custom 1 field" for the previous example.
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: Is there a way to batch rename the filename?

Post by steviegt »

That was it. I was only entering the description and not a preset name. Common sense. :oops:
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"
Guest

Re: Is there a way to batch rename the filename?

Post by Guest »

Have you tried to turn on the "Delete emptied folders when moving files as a result of the Path modification" option?
Yes, but I cannot do this in Auto organize - that's why I tried RegExp - afer renaming in RegExp I get duplicated folders.
Find what:

Code: Select all

^.*
Into: Custom 1
Regular expression 1: checked
Replace with:

Code: Select all

Int(SQLQuery("SELECT Sum(Bitrate * SongLength) / Sum(SongLength) FROM Songs WHERE IDAlbum = " & oSongData.Album.ID & " GROUP BY IDAlbum") / 1000)
VBScript expression: checked
Thanks. This works. Now I can do something like this (Custom 1 = min, Custom 2 = max, Custom 3 = average):

.\<Album Artist>\<Album> [$if(<Custom 1><><Custom 2>,VBR <Custom 1>-<Custom 2>,<Custom 3>)]\<Track#:2> - <Title>

Such auto organize will also delete emptied folders. Of course I still wish there would be more elegant solution.
Teknojnky
Posts: 5537
Joined: Tue Sep 06, 2005 11:01 pm
Contact:

Re: Is there a way to batch rename the filename?

Post by Teknojnky »

The simplest solution is to simply ignore bitrate and use only <type>.

The problem, as you may have figured out, is that organizing works at the individual file level, not on an album or group level. In order to support putting an average bitrate, the average has to be calculated some how and stored in each individual file tag somewhere.

I settled for this mask:

Code: Select all

$left(\Media\$upper(<Type>)\$if(<Album Artist>,$if(<Album Artist>=various,_<Album Artist>,$if(<Album Artist>=techno,_<Album Artist>,$if(<Album Artist>=soundtrack,_<Album Artist>,<Album Artist@1>\<Album Artist>))),<Artist@1>\<Artist>)\$if(<Album>,$if(<Year>,<Year> - )<Album> [$upper(<Type>)])\$if(<Track#>,<Track#:2> - )<Artist> - <Title>,240)
This segregates my library in to the main file types and also indicates in the album folder name what file type.

like so:

J:\Media\FLAC\T\Tool\1996 - Ænima [FLAC]\01 - Tool - Stinkfist.flac
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Re: Is there a way to batch rename the filename?

Post by ZvezdanD »

Guest wrote:
Have you tried to turn on the "Delete emptied folders when moving files as a result of the Path modification" option?
Yes, but I cannot do this in Auto organize - that's why I tried RegExp - afer renaming in RegExp I get duplicated folders.
I think that you didn't understand. The RegExp script has mentioned option, it is in the Tools / Options dialog box, on the RegExp Find and Replace tab. If you check that option emptied folders after moving files would be removed.
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
Teknojnky
Posts: 5537
Joined: Tue Sep 06, 2005 11:01 pm
Contact:

Re: Is there a way to batch rename the filename?

Post by Teknojnky »

I added a feature request for the <vbr> mask to auto-organize masks.

http://www.ventismedia.com/mantis/view.php?id=5490

This would allow auto-org masks to easily rename to show vbr or cbr+bitrate.

Of course this does not help with average album vbr bitrate, but you could just leave the bitrate off vbr and only put on cbr, like

\artist\album [mp3 vbr]\tracks
\artist\album [mp3 192k cbr]\tracks

or
\artist\album [mp3 192k]\tracks
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Re: Is there a way to batch rename the filename?

Post by ZvezdanD »

Teknojnky wrote:In order to support putting an average bitrate, the average has to be calculated some how and stored in each individual file tag somewhere.
It has not to be stored in each file. With my script and mentioned preset the average is stored only in the file path.

By the way, my script already supports VBR field and many other which is not available with Auto-Organize.
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
Teknojnky
Posts: 5537
Joined: Tue Sep 06, 2005 11:01 pm
Contact:

Re: Is there a way to batch rename the filename?

Post by Teknojnky »

True an elegant solution, I was referring to available auto-organize masks tho.
Guest

Re: Is there a way to batch rename the filename?

Post by Guest »

I think that you didn't understand. The RegExp script has mentioned option, it is in the Tools / Options dialog box, on the RegExp Find and Replace tab. If you check that option emptied folders after moving files would be removed.
Oh, thanks! What a great and active support!

May I ask another question related to your other answer? How would I incorporate VBR field in your preset, like
if VBR then show ["VBR" bitrate] else only [bitrate]?
ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Re: Is there a way to batch rename the filename?

Post by ZvezdanD »

This is something similar with this topic: http://www.mediamonkey.com/forum/viewto ... 32#p152232. You should modify "Assign the weighted average Bitrate of the album to the last folder of the Path" preset and the Replace with string, but keep in mind that this expression contains two SQLQuery functions and would be much slower:

Code: Select all

"$1\$2 [" & IIf(SQLQuery("SELECT Max(VBR) FROM Songs WHERE IDAlbum = " & oSongData.Album.ID & " GROUP BY IDAlbum"), "VBR ", "") & Int(SQLQuery("SELECT Avg(Bitrate) FROM Songs WHERE IDAlbum = " & oSongData.Album.ID & " GROUP BY IDAlbum") / 1000) & " kbps]\$3.$4"
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