Last change
on this file since 37 was
37,
checked in by peter, 10 years ago
|
id3dump, id3load, id3ascii: scripts to dump and load ID3 info from an Mp3 file, and a script that converts ID3 tags down to ASCII-only
|
-
Property svn:executable set to
*
|
File size:
727 bytes
|
Line | |
---|
1 | #!/usr/bin/perl -w |
---|
2 | use strict; |
---|
3 | |
---|
4 | # reads tags from STDIN and applies them to the MP3 file given as the first argument |
---|
5 | |
---|
6 | use MP3::Tag; |
---|
7 | |
---|
8 | my $audio_file = shift or die "Usage: $0 <mp3-file>\n"; |
---|
9 | my $mp3 = MP3::Tag->new($audio_file); |
---|
10 | |
---|
11 | my %method_for = ( |
---|
12 | ALBUM => sub { $_[0]->album_set($_[1]) }, |
---|
13 | ARTIST => sub { $_[0]->artist_set($_[1]) }, |
---|
14 | DATE => sub { $_[0]->year_set($_[1]) }, |
---|
15 | TITLE => sub { $_[0]->title_set($_[1]) }, |
---|
16 | TRACKNUMBER => sub { $_[0]->track_set($_[1]) }, |
---|
17 | ); |
---|
18 | |
---|
19 | while (<>) { |
---|
20 | chomp; |
---|
21 | next if /\s*#/; |
---|
22 | next unless /\S/; |
---|
23 | my ($key, $value) = split(/=/, $_, 2); |
---|
24 | if (exists $method_for{$key}) { |
---|
25 | $method_for{$key}->($mp3, $value); |
---|
26 | } |
---|
27 | } |
---|
28 | |
---|
29 | $mp3->update_tags; |
---|
Note: See
TracBrowser
for help on using the repository browser.