Fixed "Use Cron" issue

This commit is contained in:
Saqib Razzaq 2016-06-30 05:36:31 -07:00
parent bb9b459c8d
commit a5878dabe9
2 changed files with 18 additions and 1 deletions

View file

@ -12,9 +12,12 @@
getting the aguments getting the aguments
$argv[1] => first argument, in our case its the path of the file $argv[1] => first argument, in our case its the path of the file
*/ */
if (config('use_crons') == 'yes') {
$argv = convertWithCron();
}
//error_reporting(E_ALL); //error_reporting(E_ALL);
#file_put_contents('__argv__', $argv[1]."\n".$argv[2]."\n".$argv[3]."\n".$argv[4]."\n");
logData(json_encode($argv),"argvs"); logData(json_encode($argv),"argvs");
$fileName = (isset($argv[1])) ? $argv[1] : false; $fileName = (isset($argv[1])) ? $argv[1] : false;
//This is exact file name of a video e.g 132456789 //This is exact file name of a video e.g 132456789

View file

@ -1924,3 +1924,17 @@
return array_filter($vid_dets); return array_filter($vid_dets);
} }
function convertWithCron() {
global $db;
$toConvert = $db->select(tbl("conversion_queue"),"*","cqueue_conversion ='no' ORDER BY cqueue_id ASC LIMIT 0,1");
$filedata = $toConvert[0];
$dateDir = str_replace('-', '/', $filedata['date_added']);
$dateDir = substr($dateDir, 0, strpos($dateDir, ' '));
$returnData = array();
$returnData[1] = $filedata['cqueue_name'].'.'.$filedata['cqueue_ext'];
$returnData[2] = $filedata['cqueue_name'];
$returnData[3] = $dateDir;
$returnData[4] = FILES_DIR.'/logs/'.$dateDir.'/'.$filedata['cqueue_name'].'.log';
return $returnData;
}