|
|
Incorrect "Total Time" in iTunes XML library?
|
|
|
|
Mac Elite
Join Date: Jan 2001
Status:
Offline
|
|
I'm writing a program to read in the durations of the songs in the iTunes Music Library.xml file. However, I'm noticing that the numbers are not equal to the duration reported in iTunes or Quicktime. I assumed the Total Time number was in milliseconds, but dividing them by 1000 and then by 60 is returning a minute duration that is anywhere between 20-40 seconds off of what the actual duration is.
Any ideas? Thanks!
|
|
|
|
|
|
|
|
|
Professional Poster
Join Date: Mar 2003
Location: Down by the river
Status:
Offline
|
|
Do you take the decimal (subtract the whole number) and multiply that by 60 to get the number of seconds?
For example, if a group of songs were 12970987 mS duration, divide that by 1000, then divide it again by 60 to get roughly 216.1831167 minutes. Subtract 216 from that leaving the decimal and multiply it by 60 to convert the fractional minutes to actual seconds which is 10.987. So 12970987 mS is equal to 216 minutes and 11 seconds (rounded). You could do the same thing with the minutes and divide 216 by 60 which equals 3.6 hours then subtract 3 and multiply by 60 leaving 36 minutes.
|
|
|
|
|
|
|
|
|
Addicted to MacNN
Join Date: Aug 2004
Location: FFM
Status:
Offline
|
|
It's correct for the first two songs in my XML library.
Did you consider the difference between the decimal and duodecimal system when dealing with time (ie. a 4.5 minute song is 4 minutes and 30 seconds)?
|
|
|
|
|
|
|
|
|
Mac Elite
Join Date: Jan 2001
Status:
Offline
|
|
Ah, that worked, thanks!
Edit: multiplying decimal by 60, which I think both are you were saying
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|