[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-gnupod] bug in MP3::Info? GNUpod::FileMagic::__is_mp3 gets time wro

From: Mark Hedges
Subject: [Bug-gnupod] bug in MP3::Info? GNUpod::FileMagic::__is_mp3 gets time wrong
Date: Thu, 19 Jan 2006 12:51:01 -0800 (PST)

I got an iPod recently and after flashing the wrong rom and
restoring it at the apple store, it seemed to work great.

Except, some songs cut off before they're supposed to end.  When
I play the source mp3 files in xmms they work fine.

I tracked this down to a possible bug in MP3::Info, or the way
that GNUpod::FileMagic::__is_mp3() calculates the time.  For
example, on "The Modern Things" from Bjork's album Post, I get
these differences between use of MP3::Info and a hack that I
added to FileMagic.pm to use the 'checkmp3' utility.

 $rh{time}     = int($h->{SECS}*1000);
 $rh{fdesc}    = "MPEG ${$h}{VERSION} layer ${$h}{LAYER} file";

 warn "\nrh{time} came through as '$rh{time}'\n";


     my $truetime = `/usr/bin/checkmp3 '$file' | /bin/grep SONG_LENGTH | 
/usr/bin/awk '{ print \$2; }'`;
     $truetime =~ s/\n//g;
     my ($min, $sec, $msec) = split m{\D}, $truetime, 3;
     warn "truetime: '$truetime', min '$min', sec '$sec', msec '$msec'\n";
     my $truetime_usecs = int( ( $msec + $sec * 100 + $min * 60 * 100 ) * 10 );
     $rh{time} = $truetime_usecs;
     warn "using '$truetime_usecs' from checkmp3 as rh{time}";
 return \%rh;


address@hidden:/var/local/mus$ gnupod_addsong -m /media/iPod/ 
mp3/Bj??rk/Post/03\ -\ The\ Modern\ Things.mp3
gnupod_addsong.pl Version 0.98.3 (C) Adrian Ulrich

rh{time} came through as '204315'
truetime: '04:10.22', min '04', sec '10', msec '22'
using '250220' from checkmp3 as rh{time} at 
/usr/share/perl5/GNUpod/FileMagic.pm line 282.
! [!!!] 'mp3/Bj??rk/Post/03 - The Modern Things.mp3' is a duplicate of song 33, 
skipping file


The default value from rh{time} ends up being about 3:24, which cuts
it off.  It ends on cue with the time calculated from `checkmp3`.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]