Page 1 of 1
playtime/playtime_string and tracks without metadata...
Posted: 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!
Posted: 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.
Posted: 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.
Posted: 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!