summaryrefslogtreecommitdiffstats
path: root/tools/songdb.pl
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2004-10-23 14:15:00 +0000
committerBjörn Stenberg <bjorn@haxx.se>2004-10-23 14:15:00 +0000
commit5883b4ed0b2e8502ab40bc1af156d031c5865a3c (patch)
treed333ed537ca88e0d8df882df5351da8dc15b1d28 /tools/songdb.pl
parent10771df007bdc01cd5c81c2eb3ee2d27f4ccff64 (diff)
downloadrockbox-5883b4ed0b2e8502ab40bc1af156d031c5865a3c.tar.gz
rockbox-5883b4ed0b2e8502ab40bc1af156d031c5865a3c.tar.bz2
rockbox-5883b4ed0b2e8502ab40bc1af156d031c5865a3c.zip
Sort songarray on track number if available
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5330 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools/songdb.pl')
-rwxr-xr-xtools/songdb.pl18
1 files changed, 15 insertions, 3 deletions
diff --git a/tools/songdb.pl b/tools/songdb.pl
index 88089972d4..fb0118d7e4 100755
--- a/tools/songdb.pl
+++ b/tools/songdb.pl
@@ -338,10 +338,22 @@ if($db) {
my $str = $t."\x00" x ($maxalbumlen - length($t));
print DB $str;
- my $a = $artistcount{$moo[0]} * $artistentrysize;
- dumpint($a + $artistindex); # pointer to artist of this album
+ my $aoffset = $artistcount{$moo[0]} * $artistentrysize;
+ dumpint($aoffset + $artistindex); # pointer to artist of this album
+
+ my @songlist = keys %{$album2songs{$albumid}};
+ my $id3 = $album2songs{$albumid}{$songlist[0]};
+ if (defined $id3->{'TRACKNUM'}) {
+ @songlist = sort {
+ $album2songs{$albumid}{$a}->{'TRACKNUM'} <=>
+ $album2songs{$albumid}{$b}->{'TRACKNUM'}
+ } @songlist;
+ }
+ else {
+ @songlist = sort @songlist;
+ }
- for (sort keys %{$album2songs{$albumid}}) {
+ for (@songlist) {
my $id3 = $album2songs{$albumid}{$_};
dumpint($$id3{'songoffset'});
}