a SERIOUS bug

Think you found a bug in getID3()? Post here with details.
Post Reply
hasanppp
User
Posts: 1
Joined: Sat Mar 08, 2014 1:47 pm
Are you a spambot?: no

a SERIOUS bug

Post by hasanppp » Sat Mar 08, 2014 1:59 pm

hi . first i want to thank for this very usefull script . second i found a very serious bug in this script . when file duration is longer than an hour the code show us a wrong result . i fix this .


FIX FORTHIS CODE :

Code: Select all

require_once('getid3/getid3.php');
	require_once('getid3/getid3.lib.php');
	  
	$getID3 = new getID3;
	  
	$mixinfo = $getID3->analyze( $path );
	  
	// Optional: copies data from all subarrays of [tags] into [comments] so
	// metadata is all available in one location for all tag formats
	// metainformation is always available under [tags] even if this is not called
	getid3_lib::CopyTagsToComments($mixinfo);
	  
	// Output desired information in whatever format you want
	// Note: all entries in [comments] or [tags] are arrays of strings
	// See structure.txt for information on what information is available where
	// or check out the output of /demos/demo.browse.php for a particular file
	// to see the full detail of what information is returned where in the array
	//echo @$ThisFileInfo['comments_html']['artist'][0]; // artist from any/all available tag formats
	//echo @$ThisFileInfo['tags']['id3v2']['title'][0];  // title from ID3v2
	$bit_rate = $mixinfo['audio']['bitrate'];           // audio bitrate
	$play_time = $mixinfo['playtime_string'];            // playtime in minutes:seconds, formatted string
	  
	//print_r($mixinfo);
	  
	  
	  
	if(substr_count($play_time,":")==2)
	{ 
		list($hours,$mins , $secs) = explode(':' , $play_time);
		  
		$play_time = (($hours*60)+($mins));
		
		if($secs>30) $play_time++;
	}
	elseif(substr_count($play_time,":")==1)
	{ 
		list($mins , $secs) = explode(':' , $play_time);
		  
		$play_time = (($mins));
		
		if($secs>30) $play_time++;
	}
	
	
	return $play_time;

James Heinrich
getID3() v1 developer
Posts: 1432
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Re: a SERIOUS bug

Post by James Heinrich » Sat Mar 08, 2014 2:23 pm

First, please confirm what version of getID3 you're using? If it's part of the discontinued ancient v2.0-alpha branch (you posted in the v2.0 forum) please stop and download the current version.
If it's an older v1.x version, please confirm that the bug you describe is still present in the latest development version.

Please also give an example of what the output from getID3 is (that is incorrect) compared to what it should be. From your code sample I'm not sure what bits are your code and what issue you're trying to fix.

Does the supposed incorrect playtime appear on all files, or only in certain cases?

Post Reply