2011-02-14 20:39:22 +00:00
|
|
|
<?php
|
2012-08-01 13:06:49 +00:00
|
|
|
|
|
|
|
/*
|
2011-02-14 20:39:22 +00:00
|
|
|
* By Arslan Hassan for reparing video durations
|
|
|
|
* it will check which videos are already processed
|
|
|
|
* and their video duration is still not fixed
|
|
|
|
* it will read files 1 by 1 and fix them all
|
2012-08-01 13:06:49 +00:00
|
|
|
*/
|
2011-02-14 20:39:22 +00:00
|
|
|
|
|
|
|
require'../includes/admin_config.php';
|
|
|
|
$userquery->admin_login_check();
|
|
|
|
$userquery->login_check('web_config_access');
|
|
|
|
|
2012-08-01 13:06:49 +00:00
|
|
|
$params = array('duration' => '1', 'duration_op' => '<=', 'status' => 'Successful');
|
2011-02-14 20:39:22 +00:00
|
|
|
$videos = get_videos($params);
|
|
|
|
$fixed_array = array();
|
2012-08-01 13:06:49 +00:00
|
|
|
|
|
|
|
$action = $_POST['action'];
|
|
|
|
if ($action) {
|
|
|
|
foreach ($videos as $video) {
|
|
|
|
$log = get_file_details($video['file_name']);
|
|
|
|
|
|
|
|
if ($log && $action == 'fix') {
|
|
|
|
//$duration = $log['output_duration'];
|
|
|
|
//if(!$duration)
|
|
|
|
// $duration = $log['duration'];
|
|
|
|
|
|
|
|
$duration = parse_duration(LOGS_DIR . '/' . $video['file_name'] . '.log');
|
|
|
|
|
|
|
|
if (!$duration)
|
|
|
|
e("Can't do anything about \"" . $video['title'] . "\"");
|
|
|
|
else {
|
|
|
|
$db->update(tbl('video'), array('duration'), array($duration), "videoid='" . $video['videoid'] . "'");
|
|
|
|
$fixed_array[$video['file_name']] = 'yes';
|
|
|
|
e("Succesfully updated duration of \"" . $video['title'] . "\" to " . SetTime($duration), 'm');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!$log && $action == 'fail') {
|
|
|
|
$db->update(tbl("video"), array("status", "failed_reason"), array('Failed', "Unable to get video duration"), " file_name='" . $video['file_name'] . "'");
|
|
|
|
e("\"" . $video['title'] . "\" status has been changed to Failed", "m");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!$log && $action == 'delete') {
|
|
|
|
$db->update(tbl("video"), array("status", "failed_reason"), array('Failed', "Unable to get video duration"), " file_name='" . $video['file_name'] . "'");
|
|
|
|
|
|
|
|
$cbvideo->delete_video($video['videoid']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$videos = get_videos($params);
|
2011-02-14 20:39:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
subtitle("Repair videos duration");
|
|
|
|
|
2012-08-01 13:06:49 +00:00
|
|
|
assign('videos', $videos);
|
|
|
|
assign('fixed_array', $fixed_array);
|
2011-02-14 20:39:22 +00:00
|
|
|
template_files('repair_vid_duration.html');
|
|
|
|
display_it();
|
|
|
|
?>
|