예제 #1
0
파일: index.php 프로젝트: sahartak/youtube
         $convertedFileNiceName = $converter->PrepareConvertedFileNameForDownload(end($fileNameParts));
         echo '<div id="conversionSuccess"></div>';
         echo '<script type="text/javascript">$(window).load(function(){ showConversionResult("' . $convertedFileName . '", "' . $convertedFileNiceName . '", "' . rawurlencode($vidInfo['title']) . '", 1); });</script>';
     } else {
         if ($converter->DownloadVideo($vidURL)) {
             $fileNameParts = explode("/", $converter->GetConvertedFileName());
             array_shift($fileNameParts);
             $convertedFileName = implode("/", $fileNameParts);
             $convertedFileNiceName = $converter->PrepareConvertedFileNameForDownload(end($fileNameParts));
             echo '<div id="conversionSuccess"></div>';
             if ($converter->GetSkipConversion()) {
                 echo '<script type="text/javascript">$(window).load(function(){ showConversionResult("' . $convertedFileName . '", "' . $convertedFileNiceName . '", "' . rawurlencode($vidInfo['title']) . '", 1); });</script>';
             } else {
                 echo '<script type="text/javascript">var progressBar = document.getElementById("progress"); progressBar.style.width = progressBar.innerHTML = "0%"; updateConversionProgress("' . $convertedFileName . '", "' . $convertedFileNiceName . '", "' . strrchr($converter->GetTempVidFileName(), '.') . '", "' . rawurlencode($vidInfo['title']) . '");</script>';
                 flush();
                 $converter->DoConversion();
                 // Configure cancel button click to abort FFmpeg process if conversion is canceled.
                 $_SESSION['ffmpegCmd'] = str_rot13(base64_encode(str_rot13(preg_replace('/( 2>.+)$/', "", $converter->GetFFmpegCommand()))));
                 $_SESSION['token'] = $_SESSION[Config::_SITENAME];
                 $_SESSION['tempVid'] = $converter->GetTempVidFileName();
                 ob_end_flush();
                 ob_flush();
                 flush();
             }
         } else {
             echo '<br /><p class="bg-danger padding-msg"><i class="fa fa-exclamation-triangle"></i> ' . Download_Error_Message . '<br /><br /><a href="http://' . $_SERVER['HTTP_HOST'] . Config::_APPROOT . '">' . Validation_Error_Suffix . '</a></p>';
         }
     }
 } else {
     echo '<div class="bg-danger padding-msg" id="conversionSuccess" style="margin:0 0 15px 0"><i class="fa fa-exclamation-triangle"></i> ' . $_SESSION['translations'][$converter->GetValidationError()] . ' ' . Validation_Error_Suffix . '</div>';
 }