Hi,

I discovered a podcast no validating due to it's duration.

The duration of the cast was 39:59 (MM:SS), but the output becomes 39:60 .

This rounds up the result to 59.6 and causes it to display incorrectly.

I'm going to try and use the hooks to correct it but thought to explain the issue.

Best,
Ben.

Comments

Bensbury’s picture

Status: Active » Closed (won't fix)

Turns out the issue is in the getID3() library.

On line 444 of getid3/lib.php the play time logic rounds the seconds, making it possible to return 60 as seconds.
This doesn't validate.

We've changed the function and floored the value to prevent the problem and leaving it here in case other people come across it for iTune feeds.
We've also told the people at getID3() in case there is a reason for rounding instead of floor.

static function PlaytimeString($seconds) {
		$sign = (($seconds < 0) ? '-' : '');
		$seconds = abs($seconds);
		$H = floor( $seconds                            / 3600);
		$M = floor(($seconds - (3600 * $H)            ) /   60);
		//$S = round( $seconds - (3600 * $H) - (60 * $M)        );
		$S = floor( $seconds - (3600 * $H) - (60 * $M)        );
		return $sign.($H ? $H.':' : '').($H ? str_pad($M, 2, '0', STR_PAD_LEFT) : intval($M)).':'.str_pad($S, 2, 0, STR_PAD_LEFT);
	}
Bensbury’s picture

Issue summary: View changes

Mistake with code example - wrong module but problem is same