[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: MP3 ID3 Tags
Anyone up for a game of golf?
> #!/usr/local/bin/perl
> use File::Find;
> use MP3::ID3v1Tag;
>
> my @directories_to_search = @ARGV;
> find (\&wanted, @directories_to_search);
> sub wanted {
>
> return unless m/\.mp3$/i; # Skip unless it has an MP3 extension
>
> my $mp3_file = MP3::ID3v1Tag->new($_);
> return unless $mp3_file; # Done if not an MP3 file
> return unless $mp3_file->got_tag; # Done if no tag
>
> my $genre = $mp3_file->get_genre(); # Get the current tag
>
> $mp3_file->set_genre("Blues"); # Set the tag by name
> $mp3_file->set_genre_num(0); # Or use the genre numbers
>
> my $save_status = $mp3_file->save; # Save the changes
>
> print "$File::Find::name updated\n"; # Tell the user
> }
> 1;
--
() Join the ASCII ribbon campaign against HTML email and Microsoft-specific
/\ attachments. If I wanted to read HTML, I would have visited your website!
Support open standards.
-
To unsubscribe, send email to majordomo@luci.org with
"unsubscribe luci-discuss" in the body.