Added : No Crons
This commit is contained in:
parent
accb8c441f
commit
6e0d7c15c1
7 changed files with 115 additions and 59 deletions
|
@ -5,4 +5,13 @@ INSERT INTO `clipbucket_svn`.`cb_config` (
|
|||
)
|
||||
VALUES (
|
||||
NULL , 'use_ffmpeg_vf', 'no'
|
||||
);
|
||||
|
||||
INSERT INTO `clipbucket_svn`.`cb_config` (
|
||||
`configid` ,
|
||||
`name` ,
|
||||
`value`
|
||||
)
|
||||
VALUES (
|
||||
NULL , 'use_crons', 'no'
|
||||
);
|
|
@ -129,7 +129,8 @@ include('../includes/config.inc.php');
|
|||
$Upload->add_conversion_queue($file_name);
|
||||
$quick_conv = config('quick_conv');
|
||||
|
||||
if($quick_conv=='yes')
|
||||
$use_crons = config('use_crons');
|
||||
if($quick_conv=='yes' || $use_crons=='no')
|
||||
exec(php_path()." -q ".BASEDIR."/actions/video_convert.php &> /dev/null &");
|
||||
}
|
||||
|
||||
|
|
|
@ -8,15 +8,17 @@
|
|||
|
||||
|
||||
|
||||
$in_bg_cron = true;
|
||||
ini_set('mysql.connect_timeout','6000');
|
||||
$in_bg_cron = true;
|
||||
ini_set('mysql.connect_timeout','6000');
|
||||
|
||||
include(dirname(__FILE__)."/../includes/config.inc.php");
|
||||
//Calling Cron Functions
|
||||
cb_call_functions('video_convert_cron');
|
||||
include(dirname(__FILE__)."/../includes/config.inc.php");
|
||||
//Calling Cron Functions
|
||||
cb_call_functions('video_convert_cron');
|
||||
|
||||
$server_friendly = config('server_friendly_conversion');
|
||||
if($server_friendly=='yes')
|
||||
$use_crons = config('use_crons');
|
||||
|
||||
if($server_friendly=='yes' && $use_crons=='yes')
|
||||
{
|
||||
/**
|
||||
* UN COMMENT IN CASE YOU ARE FACING TOO MANY MULTIPLE PROCESSESS AND CAUSING SERVER OVERLOAD
|
||||
|
@ -53,7 +55,6 @@ cb_call_functions('video_convert_cron');
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
$SYSTEM_OS = $row['sys_os'] ? $row['sys_os'] : 'linux';
|
||||
|
||||
//Including FFMPEG CLASS
|
||||
|
@ -61,7 +62,6 @@ require_once(BASEDIR.'/includes/classes/conversion/ffmpeg.class.php');
|
|||
|
||||
//Get Vido
|
||||
$queue_details = get_queued_video(TRUE);
|
||||
|
||||
//Setting up details, moving files
|
||||
$tmp_file = $queue_details['cqueue_name'];
|
||||
$tmp_ext = $queue_details['cqueue_tmp_ext'];
|
||||
|
|
|
@ -129,6 +129,7 @@ if(isset($_POST['update'])){
|
|||
'thumb_height',
|
||||
|
||||
'use_ffmpeg_vf',
|
||||
'use_crons',
|
||||
'user_comment_own',
|
||||
'user_rate_opt1' ,
|
||||
'users_items_subscriptions',
|
||||
|
|
|
@ -293,6 +293,18 @@ $(document).ready(function(){
|
|||
<div id="div_2" class="main_page_div">
|
||||
<fieldset class="fieldset" style="border:none">
|
||||
<table width="100%" border="0" cellpadding="2" cellspacing="0" class="block">
|
||||
<tr>
|
||||
<td valign="top">Use Crons</td>
|
||||
<td valign="top">
|
||||
<label>
|
||||
<input type="radio" name="use_crons" value="yes" id="use_crons_0" {if $row.use_crons =='yes'} checked="checked"{/if} />
|
||||
Yes</label>
|
||||
|
||||
<label>
|
||||
<input type="radio" name="use_crons" value="no" id="use_crons_1" {if $row.use_crons =='no'} checked="checked"{/if} />
|
||||
No</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="200" valign="top">FFMPEG Binary Path</td>
|
||||
<td valign="top"><input name="ffmpegpath" type="text" id="ffmpegpath" value="{$row.ffmpegpath}" size="45" />
|
||||
|
|
|
@ -564,7 +564,7 @@ class ffmpeg
|
|||
if( $ratio > 1.0 )
|
||||
$width = $height * $ratio;
|
||||
else
|
||||
$height = $width / $ratio;
|
||||
$height = @$width / $ratio;
|
||||
|
||||
# reduce width
|
||||
if( $width > $max_width ) {
|
||||
|
@ -644,47 +644,81 @@ class ffmpeg
|
|||
*/
|
||||
function ClipBucket()
|
||||
{
|
||||
$conv_file = TEMP_DIR.'/conv_lock.loc';
|
||||
//We will now add a loop
|
||||
//that will check weather
|
||||
|
||||
$this->start_time_check();
|
||||
$this->start_log();
|
||||
$this->prepare();
|
||||
$this->convert();
|
||||
$this->end_time_check();
|
||||
$this->total_time();
|
||||
|
||||
//Copying File To Original Folder
|
||||
if($this->keep_original=='yes')
|
||||
while(1)
|
||||
{
|
||||
$this->log .= "\r\nCopy File to original Folder";
|
||||
if(copy($this->input_file,$this->original_output_path))
|
||||
$this->log .= "\r\File Copied to original Folder...";
|
||||
else
|
||||
$this->log .= "\r\Unable to copy file to original folder...";
|
||||
$use_crons = config('use_crons');
|
||||
if(!file_exists($conv_file) || $use_crons=='yes' )
|
||||
{
|
||||
|
||||
if($use_crons=='no')
|
||||
{
|
||||
//Lets make a file
|
||||
$file = fopen($conv_file,"w+");
|
||||
fwrite($file,"converting..");
|
||||
fclose($file);
|
||||
}
|
||||
|
||||
|
||||
$this->start_time_check();
|
||||
$this->start_log();
|
||||
$this->prepare();
|
||||
$this->convert();
|
||||
$this->end_time_check();
|
||||
$this->total_time();
|
||||
|
||||
//Copying File To Original Folder
|
||||
if($this->keep_original=='yes')
|
||||
{
|
||||
$this->log .= "\r\nCopy File to original Folder";
|
||||
if(copy($this->input_file,$this->original_output_path))
|
||||
$this->log .= "\r\File Copied to original Folder...";
|
||||
else
|
||||
$this->log .= "\r\Unable to copy file to original folder...";
|
||||
}
|
||||
|
||||
$this->output_details = $this->get_file_info($this->output_file);
|
||||
$this->log .= "\r\n\r\n";
|
||||
$this->log_ouput_file_info();
|
||||
$this->log .= "\r\n\r\nTime Took : ";
|
||||
$this->log .= $this->total_time.' seconds'."\r\n\r\n";
|
||||
|
||||
//$this->update_data();
|
||||
|
||||
$th_dim = $this->thumb_dim;
|
||||
$big_th_dim = $this->big_thumb_dim ;
|
||||
|
||||
//Generating Thumb
|
||||
if($this->gen_thumbs)
|
||||
$this->generate_thumbs($this->input_file,$this->input_details['duration'],$th_dim,$this->num_of_thumbs);
|
||||
if($this->gen_big_thumb)
|
||||
$this->generate_thumbs($this->input_file,$this->input_details['duration'],$big_th_dim,'big');
|
||||
|
||||
if(!file_exists($this->output_file))
|
||||
$this->log("conversion_status","failed");
|
||||
else
|
||||
$this->log("conversion_status","completed");
|
||||
|
||||
$this->create_log_file();
|
||||
|
||||
|
||||
if($use_crons=='no')
|
||||
{
|
||||
unlink($conv_file);
|
||||
}
|
||||
break;
|
||||
}else
|
||||
{
|
||||
if($use_crons=='no')
|
||||
sleep(10);
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$this->output_details = $this->get_file_info($this->output_file);
|
||||
$this->log .= "\r\n\r\n";
|
||||
$this->log_ouput_file_info();
|
||||
$this->log .= "\r\n\r\nTime Took : ";
|
||||
$this->log .= $this->total_time.' seconds'."\r\n\r\n";
|
||||
|
||||
//$this->update_data();
|
||||
|
||||
$th_dim = $this->thumb_dim;
|
||||
$big_th_dim = $this->big_thumb_dim ;
|
||||
|
||||
//Generating Thumb
|
||||
if($this->gen_thumbs)
|
||||
$this->generate_thumbs($this->input_file,$this->input_details['duration'],$th_dim,$this->num_of_thumbs);
|
||||
if($this->gen_big_thumb)
|
||||
$this->generate_thumbs($this->input_file,$this->input_details['duration'],$big_th_dim,'big');
|
||||
|
||||
if(!file_exists($this->output_file))
|
||||
$this->log("conversion_status","failed");
|
||||
else
|
||||
$this->log("conversion_status","completed");
|
||||
|
||||
$this->create_log_file();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1706,7 +1706,7 @@
|
|||
* Function used to update processed video
|
||||
* @param Files details
|
||||
*/
|
||||
function update_processed_video($file_array,$status='Successful')
|
||||
function update_processed_video($file_array,$status='Successful',$ingore_file_status=false)
|
||||
{
|
||||
global $db;
|
||||
$file = $file_array['cqueue_name'];
|
||||
|
@ -1717,18 +1717,17 @@
|
|||
$file_name = $file;
|
||||
|
||||
$file_path = VIDEOS_DIR.'/'.$file_array['cqueue_name'].'.flv';
|
||||
|
||||
if(file_exists($file_path))
|
||||
$file_size = @filesize($file_path);
|
||||
|
||||
if(file_exists($file_path) && $file_size>0 && !$ingore_file_status)
|
||||
{
|
||||
$file_size = filesize($file_path);
|
||||
//Now we will update video where file_name = $file_name
|
||||
if($file_size>0)
|
||||
{
|
||||
//Get Duration
|
||||
$stats = get_file_details($file_name);
|
||||
$db->update(tbl("video"),array("status","duration"),array($status,$stats['duration'])," file_name='".$file_name."'");
|
||||
}
|
||||
}
|
||||
$stats = get_file_details($file_name);
|
||||
$db->update(tbl("video"),array("status","duration"),array($status,$stats['duration'])," file_name='".$file_name."'");
|
||||
}else
|
||||
{
|
||||
$stats = get_file_details($file_name);
|
||||
$db->update(tbl("video"),array("status","duration"),array('Failed',$stats['duration'])," file_name='".$file_name."'");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue