From dcfad5001bf79331cc630aed4c22ca9643c00a3a Mon Sep 17 00:00:00 2001 From: Arslan Hassan Date: Mon, 14 Feb 2011 20:39:22 +0000 Subject: [PATCH] Added : Repair video duration --- upload/admin_area/repair_vid_duration.php | 63 +++++++++++++++++++ .../cbv2/layout/repair_vid_duration.html | 29 +++++++++ 2 files changed, 92 insertions(+) create mode 100644 upload/admin_area/repair_vid_duration.php create mode 100644 upload/admin_area/styles/cbv2/layout/repair_vid_duration.html diff --git a/upload/admin_area/repair_vid_duration.php b/upload/admin_area/repair_vid_duration.php new file mode 100644 index 00000000..fbe6e480 --- /dev/null +++ b/upload/admin_area/repair_vid_duration.php @@ -0,0 +1,63 @@ +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(); +?> \ No newline at end of file diff --git a/upload/admin_area/styles/cbv2/layout/repair_vid_duration.html b/upload/admin_area/styles/cbv2/layout/repair_vid_duration.html new file mode 100644 index 00000000..70d92d78 --- /dev/null +++ b/upload/admin_area/styles/cbv2/layout/repair_vid_duration.html @@ -0,0 +1,29 @@ +

ClipBucket video duration fix

+
+ + +Clipbucket repair video duration using file conversion logs of each file, if there is no log, duration fix is likely not possible.
+* with log => those videos that have file conversion log
+* with no log => those don't have any conversion log
+
{if $videos} +
+ + + +
+
+ + {foreach from=$videos item=video} + {assign var=filename value=$video.file_name} + {assign var=log value=func->get_file_details($filename)} +
+
+
{if $fixed_array.$filename}[FIXED] {/if}{$video.title} (duration : {$vdo.duration|setTime} | Has Log :{if $log} yes{else}no{/if} )
+
+
+ {/foreach} + {else} + No videos found with duration less than or equal to 1 + {/if} +