forked from len0rd/rockbox
present table to the user, easily converted to binary form once we settle
on a format git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5303 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
6694212a6f
commit
d24766675d
1 changed files with 57 additions and 3 deletions
|
@ -9,6 +9,11 @@ use MP3::Info;
|
||||||
|
|
||||||
my $dir = $ARGV[0];
|
my $dir = $ARGV[0];
|
||||||
|
|
||||||
|
my %entries;
|
||||||
|
my %genres;
|
||||||
|
my %albums;
|
||||||
|
my %years;
|
||||||
|
|
||||||
if(! -d $dir) {
|
if(! -d $dir) {
|
||||||
print "given argument is not a directory!\n";
|
print "given argument is not a directory!\n";
|
||||||
exit;
|
exit;
|
||||||
|
@ -58,7 +63,6 @@ sub singlefile {
|
||||||
# for(keys %$hash) {
|
# for(keys %$hash) {
|
||||||
# print "Info: $_ ".$hash->{$_}."\n";
|
# print "Info: $_ ".$hash->{$_}."\n";
|
||||||
# }
|
# }
|
||||||
|
|
||||||
return $hash; # a hash reference
|
return $hash; # a hash reference
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,17 +81,67 @@ sub dodir {
|
||||||
|
|
||||||
my $id3 = singlefile("$dir/$f");
|
my $id3 = singlefile("$dir/$f");
|
||||||
|
|
||||||
printf "Artist: %s\n", $id3->{'ARTIST'};
|
# ARTIST
|
||||||
|
# COMMENT
|
||||||
|
# ALBUM
|
||||||
|
# TITLE
|
||||||
|
# GENRE
|
||||||
|
# TRACKNUM
|
||||||
|
# YEAR
|
||||||
|
|
||||||
|
#printf "Artist: %s\n", $id3->{'ARTIST'};
|
||||||
|
$entries{"$dir/$f"}= $id3;
|
||||||
|
|
||||||
|
$artists{$id3->{'ARTIST'}}++ if($id3->{'ARTIST'});
|
||||||
|
$genres{$id3->{'GENRE'}}++ if($id3->{'GENRE'});
|
||||||
|
$years{$id3->{'YEAR'}}++ if($id3->{'YEAR'});
|
||||||
|
|
||||||
|
# prepend Artist name to handle duplicate album names from other
|
||||||
|
# artists
|
||||||
|
$albums{$id3->{'ARTIST'}."___".$id3->{'ALBUM'}}++ if($id3->{'ALBUM'});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# extractdirs filters out only subdirectories from all given entries
|
# extractdirs filters out only subdirectories from all given entries
|
||||||
my @d = extractdirs($dir, @a);
|
my @d = extractdirs($dir, @a);
|
||||||
|
|
||||||
for $d (sort @d) {
|
for $d (sort @d) {
|
||||||
print "Subdir: $d\n";
|
#print "Subdir: $d\n";
|
||||||
dodir("$dir/$d");
|
dodir("$dir/$d");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
dodir($dir);
|
dodir($dir);
|
||||||
|
|
||||||
|
print "File name table\n";
|
||||||
|
for(sort keys %entries) {
|
||||||
|
printf(" %s\n", $_);
|
||||||
|
}
|
||||||
|
|
||||||
|
print "\nSong title table\n";
|
||||||
|
#for(sort {$entries{$a}->{'TITLE'} cmp $entries{$b}->{'TITLE'}} %entries) {
|
||||||
|
for(sort {$entries{$a}->{'TITLE'} cmp $entries{$b}->{'TITLE'}} keys %entries) {
|
||||||
|
printf(" %s\n", $entries{$_}->{'TITLE'} );
|
||||||
|
}
|
||||||
|
|
||||||
|
print "\nArtist table\n";
|
||||||
|
for(sort keys %artists) {
|
||||||
|
printf(" %s\n", $_);
|
||||||
|
}
|
||||||
|
|
||||||
|
print "\nGenre table\n";
|
||||||
|
for(sort keys %genres) {
|
||||||
|
printf(" %s\n", $_);
|
||||||
|
}
|
||||||
|
|
||||||
|
print "\nYear table\n";
|
||||||
|
for(sort keys %years) {
|
||||||
|
printf(" %s\n", $_);
|
||||||
|
}
|
||||||
|
|
||||||
|
print "\nAlbum table\n";
|
||||||
|
for(sort keys %albums) {
|
||||||
|
my @moo=split(/___/, $_);
|
||||||
|
printf(" %s\n", $moo[1]);
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue