summaryrefslogtreecommitdiffstats
path: root/tools/songdb.pl
diff options
context:
space:
mode:
authorRyan Jackson <rdjackso@rockbox.org>2005-07-12 16:40:50 +0000
committerRyan Jackson <rdjackso@rockbox.org>2005-07-12 16:40:50 +0000
commit40a8401cd35cef71b0ffa017106ee156fb3239ed (patch)
tree03975c03d4df8247c020bd85dea181f6bd6f700e /tools/songdb.pl
parentb3437ecbfefcc819dc3fb859f2c1e1894dd6cca1 (diff)
downloadrockbox-40a8401cd35cef71b0ffa017106ee156fb3239ed.tar.gz
rockbox-40a8401cd35cef71b0ffa017106ee156fb3239ed.tar.bz2
rockbox-40a8401cd35cef71b0ffa017106ee156fb3239ed.zip
songdb.pl now calculates the checksum for Ogg Vorbis files by starting at the first page of audio data
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7124 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 0377bfd9e6..40d23d780d 100755
--- a/tools/songdb.pl
+++ b/tools/songdb.pl
@@ -106,6 +106,16 @@ sub get_oggtag {
return \%hash;
}
+sub get_ogginfo {
+ my $fn = shift;
+ my %hash;
+
+ my $ogg = vorbiscomm->new($fn);
+
+ my $h= $ogg->load;
+
+ return $ogg->{'INFO'};
+}
# return ALL directory entries in the given dir
sub getdir {
@@ -231,17 +241,19 @@ sub crc32 {
sub singlefile {
my ($file) = @_;
my $hash;
+ my $info;
if($file =~ /\.ogg$/i) {
$hash = get_oggtag($file);
- # CRC from 0 until we figure out exactly where the audio data starts!
- $hash->{FILECRC} = crc32($file, 0);
+ $info = get_ogginfo($file);
+
+ $hash->{FILECRC} = crc32($file, $info->{audio_offset});
}
else {
$hash = get_mp3tag($file);
- my $info = get_mp3info($file);
+ $info = get_mp3info($file);
$hash->{FILECRC} = crc32($file, $info->{headersize});
}