2009-12-09 13:43:19 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This file is used to verify weather video is converted or not
|
|
|
|
* if it is converted then activate it and let it go
|
|
|
|
*/
|
|
|
|
|
2011-01-11 13:56:34 +00:00
|
|
|
//Sleeping..
|
|
|
|
//sometimes video is inserted after video conversion so in this case, video can get lost
|
|
|
|
//if($argv[2]=='sleep')
|
|
|
|
sleep(10);
|
|
|
|
|
2010-02-12 16:17:17 +00:00
|
|
|
$in_bg_cron = true;
|
2009-12-09 13:43:19 +00:00
|
|
|
|
|
|
|
include(dirname(__FILE__)."/../includes/config.inc.php");
|
|
|
|
|
2010-03-02 14:50:54 +00:00
|
|
|
cb_call_functions('verify_converted_videos_cron');
|
|
|
|
|
2011-01-10 14:59:36 +00:00
|
|
|
if($argv[1])
|
|
|
|
$fileName = $argv[1];
|
|
|
|
else
|
|
|
|
$fileName = false;
|
|
|
|
|
|
|
|
$files = get_video_being_processed($fileName);
|
|
|
|
|
2009-12-09 13:43:19 +00:00
|
|
|
if(is_array($files))
|
|
|
|
foreach($files as $file)
|
|
|
|
{
|
|
|
|
$file_details = get_file_details($file['cqueue_name']);
|
2010-02-12 16:17:17 +00:00
|
|
|
//pr($file_details);
|
2009-12-09 13:43:19 +00:00
|
|
|
if($file_details['conversion_status']=='failed')
|
|
|
|
{
|
|
|
|
|
2010-02-05 20:02:06 +00:00
|
|
|
$db->update(tbl("conversion_queue"),
|
2009-12-09 13:43:19 +00:00
|
|
|
array("cqueue_conversion"),
|
|
|
|
array("yes")," cqueue_id = '".$file['cqueue_id']."'");
|
2011-01-10 14:59:36 +00:00
|
|
|
update_processed_video($file,'Failed',$ffmpeg->failed_reason);
|
2009-12-09 13:43:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Calling Functions after converting Video
|
|
|
|
*/
|
|
|
|
if(get_functions('after_convert_functions'))
|
|
|
|
{
|
|
|
|
foreach(get_functions('after_convert_functions') as $func)
|
|
|
|
{
|
|
|
|
if(@function_exists($func))
|
2010-04-20 14:39:58 +00:00
|
|
|
$func($file_details);
|
2009-12-09 13:43:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}elseif($file_details['conversion_status']=='completed')
|
|
|
|
{
|
|
|
|
|
2010-02-05 20:02:06 +00:00
|
|
|
$db->update(tbl("conversion_queue"),
|
2010-02-12 16:17:17 +00:00
|
|
|
array("cqueue_conversion","time_completed"),
|
|
|
|
array("yes",time())," cqueue_id = '".$file['cqueue_id']."'");
|
2009-12-09 13:43:19 +00:00
|
|
|
update_processed_video($file,'Successful');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Calling Functions after converting Video
|
|
|
|
*/
|
|
|
|
if(get_functions('after_convert_functions'))
|
|
|
|
{
|
|
|
|
foreach(get_functions('after_convert_functions') as $func)
|
|
|
|
{
|
|
|
|
if(@function_exists($func))
|
2010-04-20 14:39:58 +00:00
|
|
|
$func($file_details);
|
2009-12-09 13:43:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|