Author Topic: Is there any way to get an accurate album playtime from the API?  (Read 7358 times)

Akira Q.

  • Newbie
  • *
  • Posts: 15
TL;DR MusicBee's track times are rounded so I can't add them to get an accurate album time by adding track times. Any way to fix that?

So a bit of background on why I need a solution to this problem; I've been making a database for all my music in my free time (Been doing a lot of SQL database administration in college and this seemed like the best way to make it stick) and I've been making an API that inputs all the information I keep on an album and all of its tracks for me.

I don't keep track of individual song times but I've kept track of album lengths, however getting album lengths from the API has been a bit of a challenge for me. I got it to get all of the track times from all the songs and add them together and math it into a number, but it doesn't output the same number as MusicBee gives the album time, I realized it wasn't a problem with my code but MusicBee rounds the song times so I couldn't get an accurate number. (as an example, MusicBee gives the album song length 1:02:48, but through the code it gives 1:02:41, which is accurate to the added up lengths. Only a 7 second difference for smaller albums but testing with a longer album I wound up with a 50 second difference.)

Is there any way to get the actual album time straight from MusicBee or will I just be tweaking the album time whenever I want to add an album?