Page 1 of 1

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

Posted: 03 Apr 2022 17:37
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

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

Posted: 04 Apr 2022 18:36
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;
            }
        }
    }

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

Posted: 04 Apr 2022 20:16
by Ysl
Wow ! Thank you very much !! It work :)

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

Posted: 12 Feb 2023 17:46
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

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

Posted: 12 Feb 2023 18:07
by highend

Code: Select all

renameitem(regexreplace("$artist - $year - $album", "[<>:""/\\|?*]"), $folder);

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

Posted: 12 Feb 2023 18:11
by Ysl
Perfect :)
You're the best !!

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

Posted: 24 Mar 2024 14:52
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

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

Posted: 24 Mar 2024 14:56
by highend
Help yourself, read the changelog...

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

Posted: 24 Mar 2024 15:42
by Ysl
oh Yes, thanks, just saw this has been fixed in latest update !
Working now :)