Script that will rename a folder from the mp3/flac tags

Discuss and share scripts and script files...
Post Reply
Ysl
Posts: 153
Joined: 03 Jan 2007 22:22

Script that will rename a folder from the mp3/flac tags

Post by Ysl »

Hi

I'm looking for a script that will rename a folder from the tags of the mp3 or flac file inside the folder.

If you have a folder named "Thriller", the script should rename it "Michael Jackson - 1982 - Thriller"

So, the script should 'open'/go inside the folder, isolate all .flac or .mp3 files, then select one of those files and extract the Artist + year + Album tags and rename the folder "Michael Jackson - 1982 - Thriller"

It will bypass the tag if it's empty

Hope this is possible and not too complicated...

Thank you for your help

Ysl

highend
Posts: 13311
Joined: 06 Feb 2011 00:33

Re: Script that will rename a folder from the mp3/flac tags

Post by highend »

Code: Select all

    $folder = <curitem>;
    $files  = quicksearch("*.mp3;*.flac /n", $folder, , "s");
    if ($files) {
        foreach($file, $files, <crlf>, "e") {
            $artist = property("#tag.artist", $file);
            $year   = property("#tag.year", $file);
            $album  = property("#tag.album", $file);

            if ($artist && $year && $album) {
                renameitem("$artist - $year - $album", $folder);
                end true;
            }
        }
    }
One of my scripts helped you out? Please donate via Paypal

Ysl
Posts: 153
Joined: 03 Jan 2007 22:22

Re: Script that will rename a folder from the mp3/flac tags

Post by Ysl »

Wow ! Thank you very much !! It work :)

Ysl
Posts: 153
Joined: 03 Jan 2007 22:22

Re: Script that will rename a folder from the mp3/flac tags

Post by Ysl »

Thank you again for this script which I use almost daily :)

Could you please improve it to avoid error message saying "contains invalid characters" (like :/)

Thank you

highend
Posts: 13311
Joined: 06 Feb 2011 00:33

Re: Script that will rename a folder from the mp3/flac tags

Post by highend »

Code: Select all

renameitem(regexreplace("$artist - $year - $album", "[<>:""/\\|?*]"), $folder);
One of my scripts helped you out? Please donate via Paypal

Ysl
Posts: 153
Joined: 03 Jan 2007 22:22

Re: Script that will rename a folder from the mp3/flac tags

Post by Ysl »

Perfect :)
You're the best !!

Ysl
Posts: 153
Joined: 03 Jan 2007 22:22

Re: Script that will rename a folder from the mp3/flac tags

Post by Ysl »

Hi
Since upgrading to 25.70 this script isn't working any more....
I noticed also that the built in 'Mp3 rename Special' isn't working any more either..
Can someone help me please ?
Thanks
Ysl

highend
Posts: 13311
Joined: 06 Feb 2011 00:33

Re: Script that will rename a folder from the mp3/flac tags

Post by highend »

Help yourself, read the changelog...
One of my scripts helped you out? Please donate via Paypal

Ysl
Posts: 153
Joined: 03 Jan 2007 22:22

Re: Script that will rename a folder from the mp3/flac tags

Post by Ysl »

oh Yes, thanks, just saw this has been fixed in latest update !
Working now :)

Post Reply