Quote:
Originally Posted by jibreel
Basicly i need a link after the conversion finished like "DOWNLOAD NOW" that is linked to the mp3 that they just converted, If this helps i'm hosting the website on a shared host.
|
I've gotten several requests for this feature, so I have modified the code as follows:
1) Added download link after successful conversion
2) Added conversion process progress bar
3) Some general refactoring of code
Download the revised files below. ...And please let me know if you experience any issues with the code....
Happy Holidays!
Quote:
Edit: The progress bar feature will only work for PHP versions 5.3 and above. To disable the progress bar, you need only comment out the following lines of code in YouTubeToMp3Converter.class.php:
PHP Code:
private function SaveVideo($url)
{
$this->_percentVidDownloaded = 0;
$this->SetTempVidFileName(time());
$file = fopen($this->GetTempVidFileName(), 'w');
$ch = curl_init();
curl_setopt($ch, CURLOPT_FILE, $file);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
//curl_setopt($ch, CURLOPT_NOPROGRESS, false);
//curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, array($this, 'UpdateVideoDownloadProgress'));
//curl_setopt($ch, CURLOPT_BUFFERSIZE, 4096000);
curl_exec($ch);
curl_close($ch);
fclose($file);
return is_file($this->GetTempVidFileName());
}
...and change the following line of code in index.php:
PHP Code:
echo '<div id="progress-bar"><div id="progress">0%</div></div></div>';
...to:
|