Incesticide has asked for the wisdom of the Perl Monks concerning the following question:
Thats the Perl script. Please reply asap.#!/usr/bin/perl -w use strict; use mp3::ID3v1Tag; sub Renamer { foreach (@_) { my($artist, $title) = (split '-'); ($artist, $title) = &splitter($artist, $title); rename "$_", "$artist - ${title}(1).mp3" or die "cannot rename + to $_ to ${title}.mp3: $!"; } print "finished Renaming.\n"; } sub Tagger { foreach (@_) { my($artist, $title) = (split '-'); ($artist, $title) = &splitter($artist, $title) my $mp3_file = new MP3::ID3v1Tag($_); $mp3_file->set_title($title) or die "cannot set title: $!"; $mp3_file->set_artist($artist) or die "cannot set title: $!"; $mp3_file->save() or die "Cannot save changes: $!"; } print "finished ID3 Tagging.\n"; } sub splitter { substr($_[0], -1, 1, ''); print "\$_[0] = ${_[0]}END\n"; substr($_[1], 0,1, ''); print "\$_[1] = BEGIN$_[1]\n"; substr($_[1], -4, 4, '') if substr($_[1], -4, 4) eq '.mp3'; return ($_[0], $_[1]); } print "MASS ID3 Tagger and Renamer by Incst. Input a directory or typ +e exit to exit.\n"; while (1) { chomp(my $dir = <STDIN>); if ($dir eq exit) { last; } else { chdir $dir or die "Cannot change to specified directory: $! +"; my @MP3_files = <*.mp3>; &Tagger(@MP3_files); &Renamer(@MP3_files); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: MP3-CD Burning ID3-Tagger/Renamer for Win 9x
by simon.proctor (Vicar) on Feb 18, 2002 at 23:58 UTC | |
by Anonymous Monk on Feb 19, 2002 at 00:03 UTC | |
|
Re: MP3-CD Burning ID3-Tagger/Renamer for Win 9x
by Incesticide (Initiate) on Feb 18, 2002 at 22:54 UTC |