playtime/playtime_string and tracks without metadata...

The place for "I can't figure out how to..." questions.
Post Reply
jxn
User
Posts: 7
Joined: Thu Feb 23, 2006 4:14 pm

playtime/playtime_string and tracks without metadata...

Post by jxn » Mon Aug 20, 2007 1:59 pm

I've been trying to import tracks (for the most part which have no metatags, as far as I know). All I need from these tracks (some vbr OGG, some mp3, some wav) is the playtime (in seconds)... I've seen a couple of similar posts along these lines in the forum, but I am already using the $fileInfo['playtime_string'] var to search for the playtime. Anyway, it seems to me that getId3 simply reads the playtime from the metatags, but I was wondering if it is possible to calculate it for files which have no proper tags?

Thanks for your help!

James Heinrich
getID3() v1 developer
Posts: 1476
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Post by James Heinrich » Tue Aug 21, 2007 1:21 am

getID3 calculates playtime from the file data itself. Only a few formats contain playtime information in the metadata, and for those formats the calculated playtime is compared with the meta-stored playtime and if they don't match a warning is issued (usually this would indicate a truncated file where the actual playtime is less than the metaplaytime). But metadata is considered untrustworthy and getID3 calculates all values such as bitrate and playtime from the actual file data wherever possible.

jxn
User
Posts: 7
Joined: Thu Feb 23, 2006 4:14 pm

Post by jxn » Tue Aug 21, 2007 4:36 pm

okay, thanks... I guess now I've only got to figure out why it doesn't seem to be calculating anything for playtime_seconds on some tracks (where it works fine on others)... Perhaps there's a bug in my code, but I'll see if I can come up with anything.

jxn
User
Posts: 7
Joined: Thu Feb 23, 2006 4:14 pm

Post by jxn » Tue Aug 21, 2007 4:57 pm

oops... It turns out the mistake was mine (I'd forgotten that in the function I'd written, I'd opted to return false where no track number, title, name, etc. was returned); You've got my most sincere apologies for wasting your time on this problem! Thanks, though!

Post Reply