Help - Search - Members - Calendar
Full Version: RFE: playlist length in microseconds
Hydrogenaudio Forums > Hosted Forums > foobar2000 > General - (fb2k)
kjoonlee
Hullo, the XSPF playlist format requires track lengths to be in microseconds. I tried foobar2000 0.9 and foo_utils for creating an XSPF playlist, but I ran into problems.

$mul(%_length_seconds_fp%,1000)

The results of the string above is no different from the results of $mul(%_length_seconds%,1000).

For example, with a song with 431004 samples:
%_length_seconds%$crlf()
$mul(%_length_seconds%,1000)$crlf()
%_length_seconds_fp%$crlf()
$mul(%_length_seconds_fp%,1000)$crlf()

gives:
9
9000
9.773333
9000

This doesn't matter much, because the XSPF spec explicitly states that you shouldn't assume lengths are accurate, but having an easy way to get track length in microseconds would be a nice addition, IMHO.

I would be very grateful if you consider adding this. Thank you.
kjoonlee
Silly me. I mean milliseconds, not microseconds, of course.
Silverbolt
Not as good as a floating-point $mul(), but you can try this:
CODE
$left($replace(%_length_seconds_fp%,.,),
$add($strchr(%_length_seconds_fp%,.),2))
$if($greater($len($insert(%_length_seconds_fp%,,
$strchr(%_length_seconds_fp%,.))),3),
$insert(%_length_seconds_fp%,.,
$add($strchr(%_length_seconds_fp%,.),3)),
$repeat(0,$sub(3,$len($insert(%_length_seconds_fp%,,
$strchr(%_length_seconds_fp%,.))))))
kjoonlee
That's very nice. smile.gif Thank you.

The XSPF spec wants it as an unsigned integer, so I enclosed it with $mul(,1) and it works flawlessly, as far as I can tell.

Relevant link: http://www.hydrogenaudio.org/forums/index....showtopic=38534
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.