Added : Repair video duration
This commit is contained in:
parent
307b05d552
commit
dcfad5001b
2 changed files with 92 additions and 0 deletions
63
upload/admin_area/repair_vid_duration.php
Normal file
63
upload/admin_area/repair_vid_duration.php
Normal file
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
require'../includes/admin_config.php';
|
||||
$userquery->admin_login_check();
|
||||
$userquery->login_check('web_config_access');
|
||||
|
||||
$params = array('duration'=>'1','duration_op'=>'<=','status'=>'Successful');
|
||||
$videos = get_videos($params);
|
||||
$fixed_array = array();
|
||||
if($_POST['fix_duration']
|
||||
|| $_POST['mark_failed']
|
||||
|| $_POST['mark_delete'])
|
||||
{
|
||||
foreach($videos as $video)
|
||||
{
|
||||
$log = get_file_details($video['file_name']);
|
||||
|
||||
if($log && $_POST['fix_duration'])
|
||||
{
|
||||
$duration = $log['output_duration'];
|
||||
if(!$duration)
|
||||
$duration = $log['duration'];
|
||||
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 && $_POST['mark_failed'])
|
||||
{
|
||||
$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 && $_POST['mark_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);
|
||||
}
|
||||
|
||||
subtitle("Repair videos duration");
|
||||
|
||||
assign('videos',$videos);
|
||||
assign('fixed_array',$fixed_array);
|
||||
template_files('repair_vid_duration.html');
|
||||
display_it();
|
||||
?>
|
|
@ -0,0 +1,29 @@
|
|||
<h2>ClipBucket video duration fix</h2>
|
||||
<div style="margin:10px 0px">
|
||||
|
||||
|
||||
Clipbucket repair video duration using file conversion logs of each file, if there is no log, duration fix is likely not possible.<br />
|
||||
* with log => those videos that have file conversion log<br />
|
||||
* with no log => those don't have any conversion log</div>
|
||||
<div class="cb_div">{if $videos}
|
||||
<form name="fix duration" method="post">
|
||||
<input type="submit" name="fix_duration" value="Fix duration (only with log)" class="button"/>
|
||||
<input type="submit" name="mark_failed" value="Mark failed (with no log)" class="button"/>
|
||||
<input type="submit" name="mark_delete" value="Delete (with no log)" class="button"/>
|
||||
</form>
|
||||
<div style="height:10px"></div>
|
||||
|
||||
{foreach from=$videos item=video}
|
||||
{assign var=filename value=$video.file_name}
|
||||
{assign var=log value=func->get_file_details($filename)}
|
||||
<div style="margin-bottom:5px">
|
||||
<div style="display:inline-block; float:left"><img src="{getThumb vdetails=$video}" height="20" width="20"/></div>
|
||||
<div style="padding-left:25px">{if $fixed_array.$filename}<strong>[FIXED]</strong> {/if}<a href='edit_video.php?video={$video.videoid}' style="color:#06c; font-weight:bold; text-decoration:{if $fixed_array.$filename}line-through {else}none{/if}
|
||||
">{$video.title}</a> (duration : <strong>{$vdo.duration|setTime}</strong> | Has Log :<strong>{if $log} <span style="color:#060">yes</span>{else}<span style="color:#ed0000">no</span>{/if} </strong> )</div>
|
||||
<div style="clear:both"></div>
|
||||
</div>
|
||||
{/foreach}
|
||||
{else}
|
||||
<em><strong>No videos found with duration less than or equal to 1</strong></em>
|
||||
{/if}
|
||||
</div>
|
Loading…
Add table
Reference in a new issue