summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-10-18 08:08:21 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-10-18 08:08:21 +0000
commitd24766675db5faddb67810ca67b37491d49c2313 (patch)
treef6f034f73555cef4fbaa543dc89f6363f750fdaa /tools
parent6694212a6f2eda4bd70933ddabbc0243652f32d1 (diff)
downloadrockbox-d24766675db5faddb67810ca67b37491d49c2313.tar.gz
rockbox-d24766675db5faddb67810ca67b37491d49c2313.zip
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
Diffstat (limited to 'tools')
-rwxr-xr-xtools/songdb.pl60
1 files changed, 57 insertions, 3 deletions
diff --git a/tools/songdb.pl b/tools/songdb.pl
index 64bce440b5..73c8e94c09 100755
--- a/tools/songdb.pl
+++ b/tools/songdb.pl
@@ -9,6 +9,11 @@ use MP3::Info;
my $dir = $ARGV[0];
+my %entries;
+my %genres;
+my %albums;
+my %years;
+
if(! -d $dir) {
print "given argument is not a directory!\n";
exit;
@@ -58,7 +63,6 @@ sub singlefile {
# for(keys %$hash) {
# print "Info: $_ ".$hash->{$_}."\n";
# }
-
return $hash; # a hash reference
}
@@ -77,17 +81,67 @@ sub dodir {
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
my @d = extractdirs($dir, @a);
for $d (sort @d) {
- print "Subdir: $d\n";
+ #print "Subdir: $d\n";
dodir("$dir/$d");
}
}
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]);
+}