Jump to content

[SOLVED] Music Sample Script Help


ccrevcypsys

Recommended Posts

So i added the cmp3split to my web site. But it is returning these err0rs when i upload a song.

Warning: Division by zero in /home/streamru/public_html/includes/cmp3split.inc.php on line 78

 

Warning: fseek(): supplied argument is not a valid stream resource in /home/streamru/public_html/includes/cmp3split.inc.php on line 88

here is the php code from the musicupload page

if(is_array($_FILES['digitalDir'])){
	$date_str=date('Ymdhis');
	$songeFormat = strtoupper(ereg_replace(".*\.(.*)$","\\1",$_FILES['digitalDir']['name']));
	$songSample_format = strtoupper(ereg_replace(".*\.(.*)$","\\1",$_FILES['digitalSample']['name']));
	if($songeFormat=='MP3' || $songeFormat=='FLV' || $songeFormat=='WMA'){

	copy($_FILES['digitalDir']['tmp_name'],"songs/".$date_str."_".str_replace('-','_',str_replace(' ','_',$_FILES['digitalDir']['name'])));
	$record["digitalDir"] = $db->mySQLSafe("songs/".$date_str."_".str_replace('-','_',str_replace(' ','_',$_FILES['digitalDir']['name'])));
if(is_array($_FILES['digitalDir'])){
$query = "SELECT digitalDir FROM ".$glob['dbprefix']."StreamRush_inventory";
$songres = $db->select($query);

	$songLocation = $songres['digitalDir'];
	$sampleLocation = "songs/".$date_str."_".str_replace('-','_',str_replace(' ','_',$_FILES['digitalDir']['name']));
	$songLength = 100;
	$oSplit=new CMP3Split($songLocation,$songLenght,$sampleLocation,10,1);
	$oSplit->Generate();
	echo $oSplit->cError;
			$record["digital_sample"] = $db->mySQLSafe("songs/samples/".$date_str."_".str_replace('-','_',str_replace(' ','_',$_FILES['digitalDir']['name'])));

}
	}
}
}

heres the code from the cmp3split

   function __BytePerSec()
  {
    $this->__bytePerSec=(integer)($this->__iInputFileSize/$this->__iInputFileLength);
  }

/*.............................................................*/     
  function __makeNewMp3($iMode)
  {
    $iByteAnz=$this->__iStartTime*$this->__bytePerSec; 
    
    if ($iMode==1)	
    {
    fseek($this->__inputFp,$iByteAnz);                  
    while (!@feof($this->__inputFp) )
        @fwrite($this->__outputFp, @fread($this->__inputFp, $this->iTmpBuffer));
    }
    else						
    {
    	while(@ftell($this->__inputFp)<=((integer)$iByteAnz))
    			@fwrite($this->__outputFp, @fread($this->__inputFp, ($this->__bytePerSec/2)));
    }
  }

Link to comment
Share on other sites

Warning: Division by zero in /home/streamru/public_html/includes/cmp3split.inc.php on line 78

 

Warning: fseek(): supplied argument is not a valid stream resource in /home/streamru/public_html/includes/cmp3split.inc.php on line 88

 

Where is line 78 of cmp3split.inc.php?

 

Where is line 88?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.