Here's a quick and dirty script you can use to prefix your .mp3 files with their track numbers. If you've ever dealt with Tidal, you should find this very useful:
#!/usr/bin/env raku
use Audio::Taglib::Simple;
use File::Find;
sub MAIN ($dir = '.') {
for find(:$dir, name => / :i '.mp3' $/) {
if .basename ~~ / ^ \d+ / {
say "Skipping '{ .basename }'";
} else {
my $t = Audio::Taglib::Simple.new($_);
my $newname = "{ $t.track.fmt('%02d') }-{ .basename }";
.basename.IO.rename($newname);
say "Renamed '{ .basename }' to { $newname }";
}
}
}
You should zef install Audio::Taglib::Simple File::Find
before you attempt to run this script.
Have comments, please leave them on this gist. Have improvements? Also leave them here.
UPDATE: Incorporates @lizmat++'s suggestion in the comments
Why not put this in a
MAIN
sub with a parameter to indicate the directory to look into? With a default to "." ?