Update : ClipBucket Reindexer

Added : FFMPEG vf option
Fixed : User total comments typo
This commit is contained in:
Arslan Hassan 2010-07-18 20:14:21 +00:00
parent e2d6f21ba2
commit 17e44dcbce
16 changed files with 359 additions and 65 deletions

8
sql/2.0.7~2.0.8.txt Normal file
View file

@ -0,0 +1,8 @@
INSERT INTO `clipbucket_svn`.`cb_config` (
`configid` ,
`name` ,
`value`
)
VALUES (
NULL , 'use_ffmpeg_vf', 'no'
);

View file

@ -128,6 +128,7 @@ if(isset($_POST['update'])){
'thumb_width',
'thumb_height',
'use_ffmpeg_vf',
'user_comment_own',
'user_rate_opt1' ,
'users_items_subscriptions',

View file

@ -27,64 +27,131 @@ function p_r($array)
echo "</pre>";
}
$start_index = $_GET['start_index'] ? $_GET['start_index'] : 0;
$loop_size = $_GET['loop_size'];
$loop_size = $loop_size ? $loop_size : 5;
assign('loop_size',$loop_size);
$next_index = $start_index+$loop_size;
assign('next_index',$next_index);
//Reindex Videos
if(isset($_POST['index_vids'])) {
$videos = get_videos(array("active"=>"yes","status"=>"Successful"));
if(isset($_GET['index_vids']))
{
$videos = get_videos(array("active"=>"yes","status"=>"Successful","limit"=>$start_index.",".$loop_size));
$total_videos = get_videos(array("count_only"=>true,"active"=>"yes","status"=>"Successful"));
$percent = number_format(50 * $total_videos / 100);
$i = 0;
while($i < $total_videos) {
assign('total',$total_videos);
assign('from',$start_index+1);
$to = $start_index+$loop_size;
if($to>$total_videos)
{
$to = $total_videos;
e($total_videos." videos have been reindexed successfully.","m");
assign("stop_loop","yes");
}
assign('to',$to);
while($i < $total_videos)
{
if($videos[$i]['videoid'])
{
$params = array("video_id"=>$videos[$i]['videoid'],"video_comments"=>true,"favs_count"=>true,"playlist_count"=>true);
$indexes = $cbindex->count_index("vid",$params);
$fields = $cbindex->extract_fields("vid",$params);
$cbindex->update_index("vid",array("fields"=>$fields,"values"=>$indexes,"video_id"=>$videos[$i]['videoid']));
$msg[] = $videos[$i]['video'].": Updating <strong><em>".$videos[$i]['title']."</em></strong>";
$cbindex->update_index("vid",array("fields"=>$fields,"values"=>$indexes,"video_id"=>$videos[$i]['videoid']));
}
$i++;
}
e($total_videos." videos have been reindexed successfully.","m");
e($start_index+1 ." - ".$to." videos have been reindexed successfully.","m");
assign("index_msgs",$msg);
assign("indexing","yes");
assign('mode','index_vids');
}
//Reindex Users
if(isset($_POST['index_usrs'])) {
$users = get_users(array("usr_status"=>"Ok"));
if(isset($_GET['index_usrs'])) {
$msg = array();
$users = get_users(array("usr_status"=>"Ok","limit"=>$start_index.",".$loop_size));
$total_users = get_users(array("count_only"=>true,"usr_status"=>"Ok"));
$percent = $cbindex->percent(50,$total_users);
$i = 0;
while($i < $total_users) {
$params = array("user"=>$users[$i]['userid'],"comment_added"=>true,"subscriptions_count"=>true,"subscribers_count"=>true,
"video_count"=>true,"groups_count"=>true);
$indexes = $cbindex->count_index("user",$params);
$fields = $cbindex->extract_fields("user",$params);
$cbindex->update_index("user",array("fields"=>$fields,"values"=>$indexes,"user"=>$users[$i]['userid']));
$i++;
}
e($total_users." users have been reindexed successfully.","m");
assign('total',$total_users);
assign('from',$start_index+1);
$to = $start_index+$loop_size;
if($to>$total_users)
{
$to = $total_users;
e($total_users." users have been reindexed successfully.","m");
assign("stop_loop","yes");
}
assign('to',$to);
while($i < $total_users)
{
if($users[$i]['userid'])
{
$params = array("user"=>$users[$i]['userid'],"comment_added"=>true,"subscriptions_count"=>true,"subscribers_count"=>true,
"video_count"=>true,"groups_count"=>true,"comment_received"=>true);
$indexes = $cbindex->count_index("user",$params);
$fields = $cbindex->extract_fields("user",$params);
$msg[] = $users[$i]['userid'].": Updating <strong><em>".$users[$i]['username']."</em></strong>";
$cbindex->update_index("user",array("fields"=>$fields,"values"=>$indexes,"user"=>$users[$i]['userid']));
}
$i++;
}
e($start_index+1 ." - ".$to." users have been reindexed successfully.","m");
assign("index_msgs",$msg);
assign("indexing","yes");
assign('mode','index_usrs');
}
//Reindex Grous
if(isset($_POST['index_gps'])) {
if(isset($_GET['index_gps'])) {
$groups = get_groups(array("active"=>"yes"));
$total_groups = get_groups(array("count_only"=>true,"active"=>"yes"));
$percent = $cbindex->percent(50,$total_groups);
$i = 0;
assign('total',$total_groups);
assign('from',$start_index+1);
$to = $start_index+$loop_size;
if($to>$total_groups)
{
$to = $total_groups;
e($total_groups." groups have been reindexed successfully.","m");
assign("stop_loop","yes");
}
assign('to',$to);
while ($i < $total_groups) {
while ($i < $total_groups)
{
if($groups[$i]['group_id'])
{
$params = array("group_id"=>$groups[$i]['group_id'],"group_videos"=>true,"group_topics"=>true,"group_members"=>true);
$indexes = $cbindex->count_index("group",$params);
$fields = $cbindex->extract_fields("group",$params);
$msg[] = $groups[$i]['group_id'].": Updating <strong><em>".$groups[$i]['group_name']."</em></strong>";
$cbindex->update_index("group",array("fields"=>$fields,"values"=>$indexes,"group_id"=>$groups[$i]['group_id']));
}
$i++;
}
e($total_groups." groups have been reindexed successfully.","m");
e($start_index+1 ." - ".$to." groups have been reindexed successfully.","m");
assign("index_msgs",$msg);
assign("indexing","yes");
assign('mode','index_gps');
}
subtitle("Re-index Clipbucket");

View file

@ -21,6 +21,8 @@ var imageurl = "{$imageurl}";
<script type="text/javascript" src="{$js}/jquery_plugs/hover_intent.js"></script>
<script type="text/javascript" src="{$js}/jquery_plugs/cb.tabs.js"></script>
<script type="text/javascript" src="{$js}/jquery_plugs/cookie.js"></script>
<script type="text/javascript" src="{$js}/jquery_plugs/timer.js"></script>
<link rel="stylesheet" href="{$js}/jquery_plugs/css/jquery.tooltip.css" />
<link rel="stylesheet" href="{$js}/jquery_plugs/css/screen.css" />
<link rel="stylesheet" href="{$js}/jquery_plugs/css/tipsy.css" />

View file

@ -297,7 +297,15 @@ $(document).ready(function(){
<td width="200" valign="top">FFMPEG Binary Path</td>
<td valign="top"><input name="ffmpegpath" type="text" id="ffmpegpath" value="{$row.ffmpegpath}" size="45" />
<a href="http://docs.clip-bucket.com/clipbucket-docs/ffmpeg" target="_blank">
<img src="{$imageurl}/help.png" border="0" class="tipsy_tip" title="FFMPEG Binary Paths - Click For More Details" /></a></td>
<img src="{$imageurl}/help.png" border="0" class="tipsy_tip" title="FFMPEG Binary Paths - Click For More Details" /></a><br />
Turn on VF
<label>
<input type="radio" name="use_ffmpeg_vf" value="yes" id="use_ffmpeg_vf_0" {if $row.use_ffmpeg_vf=='yes'} checked{/if} />
Yes</label>
<label>
<input type="radio" name="use_ffmpeg_vf" value="no" id="use_ffmpeg_vf_1" {if $row.use_ffmpeg_vf=='no'} checked{/if}/>
No</label>
<a href="javascript:void(0)" target="_blank"><img src="{$imageurl}/help.png" border="0" class="tipsy_tip" title="In latest releases of FFMPEG (greator than 20000) Pad flag has been changed from pad* to vf , if your ffmpeg is greator than r20000 please check YES " /></a></td>
</tr>
<tr>
<td valign="top">PHP Binary Path</td>

View file

@ -4,28 +4,64 @@ Here you can re-index your videos, users or groups statistics. From below select
<div style="height:25px; clear:both"></div>
<table width="600" border="0" cellpadding="2" cellspacing="2">
<table width="600" border="0" cellpadding="2" cellspacing="2" class="reindex_tbl">
<tr>
<td align="left"><h4>Reindex Videos</h4></td>
<td align="left"><h4>Loop Size</h4>
number of items to reindex at once</td>
<td align="right">
<input type="text" name="textfield" style="width:60px" value="{$loop_size}" id="the_loop_size" /></td>
</tr>
<tr>
<td align="left"><h4>Reindex Videos</h4>
this will reindex total playlists, total favorites and total comments made on video</td>
<td align="right">
<form name="reindex_videos" method="post" action="">
<input type="submit" name="index_vids" id="index_vids" value="Reindex Videos" class="button"/>
<form name="reindex_videos" method="get" action="">
<input type="hidden" name="loop_size" value="" id="loop_start" />
<input type="submit" name="index_vids" id="index_vids" value="Reindex Videos" class="button"
onclick="$('#loop_start').val($('#the_loop_size').val())"/>
</form></td>
</tr>
<tr>
<td align="left"><h4>Reindex Users</h4></td>
<td align="left"><h4>Reindex Users</h4>
This will reindex total videos, total comments, total comments made, total subscribers and subscriptions, total groups owned, </td>
<td align="right">
<form name="reindex_users" method="post" action="">
<input type="submit" name="index_usrs" id="index_usrs" value="Reindex Users" class="button"/>
<form name="reindex_users" method="get" action="">
<input type="hidden" name="loop_size" value="" id="loop_start_user" />
<input type="submit" name="index_usrs" id="index_usrs" value="Reindex Users" class="button"
onclick="$('#loop_start_user').val($('#the_loop_size').val())"/>
</form></td>
</tr>
<tr>
<td align="left"><h4>Reindex Groups</h4></td>
<td align="left"><h4>Reindex Groups
</h4>
this will reindex all groups , update total members, total videos , total topics</td>
<td align="right">
<form name="reindex_groups" method="post" action="">
<input type="submit" name="index_gps" id="index_gps" value="Reindex Groups" class="button"/>
<form name="reindex_groups" method="get" action="">
<input type="hidden" name="loop_size" value="" id="loop_start_gp" />
<input type="submit" name="index_gps" id="index_gps" value="Reindex Groups" class="button"
onclick="$('#loop_start_gp').val($('#the_loop_size').val())"/>
</form></td>
</tr>
</table>
{if $indexing}
<div align="right" style="padding:5px">{$from} - {$to} of {$total}</div>
<ul>
{foreach from=$index_msgs item=themsg}
<li>{$themsg}</li>
{/foreach}
</ul>
{if $stop_loop!='yes'}
<script type="text/javascript">
var start_index = '{$next_index}';
var loop_size = '{$smarty.get.loop_size}';
var mode = '{$mode}';
{literal}$(document).oneTime(2000,function(){$(window.location).attr('href', '?loop_size='+loop_size+'&'+mode+'=yes&start_index='+start_index)});{/literal}
</script>
redirecting....do not close this window
{else}
Indexing has been completed.
{/if}
{/if}

View file

@ -203,9 +203,13 @@
<td><input name="total_videos" type="text" id="total_watched2" value="{$u.total_videos}" /></td>
</tr>
<tr>
<td><strong>Total Profile Comments</strong></td>
<td><strong>Comments Made</strong></td>
<td><input name="total_comments" type="text" id="total_watched3" value="{$u.total_comments}" /></td>
</tr>
<tr>
<td><strong>Profile Comments</strong></td>
<td><input name="comments_count" type="text" id="comments_count" value="{$u.comments_count}" /></td>
</tr>
<tr>
<td><strong>Profile Rating</strong></td>
<td><input name="rating" type="text" id="total_watched4" value="{$u.rating}" />

View file

@ -81,6 +81,7 @@ a[rel=sponsors]:hover { background:#555; border:1px solid #232323; }
h2,.page_title{font-size:18px; margin:5px 0px 5px 0px; display:inline; font-weight:normal}
h2,.page_title a{font-size:18px; }
h4{margin:2px 0px}
/**
* Forms
@ -280,4 +281,7 @@ margin-top: 0;
.cb_div{border:1px solid #CCC; padding:10px; margin:10px; margin-left:0px }
.cb_div td{border-bottom:1px solid #CCC}
.cb_div .heading{background-color:#F2F2F2; font-weight:bold}
.cb_div input[type=submit]{padding:5px}
.cb_div input[type=submit]{padding:5px}
.reindex_tbl .button {width:130px}
.reindex_tbl td{height:60px}

View file

@ -308,6 +308,7 @@ class ClipBucket
'PHP Info' => 'phpinfo.php',
'Server Modules Info' => 'cb_mod_check.php',
'Conversion Queue Manager' => 'cb_conversion_queue.php',
'ReIndexer' => 'reindex_cb.php',
//'View Encoding Status'=>'',
),

View file

@ -150,8 +150,17 @@ class ffmpeg
# video size, aspect and padding
$this->calculate_size_padding( $p, $i, $width, $height, $ratio, $pad_top, $pad_bottom, $pad_left, $pad_right );
$use_vf = config('use_ffmpeg_vf');
if($use_vf=='no')
{
$opt_av .= " -s {$width}x{$height} -aspect $ratio -padcolor 000000 -padtop $pad_top -padbottom $pad_bottom -padleft $pad_left -padright $pad_right ";
}else
{
$opt_av .= "-s {$width}x{$height} -aspect $ratio -vf 'pad=0:0:0:0:black'";
}
# audio codec, rate and bitrate
if($p['use_audio_codec'])

View file

@ -2591,6 +2591,8 @@ class userquery extends CBCategory{
$uquery_val[] = $array['total_comments'];
$uquery_field[] = 'subscribers';
$uquery_val[] = $array['subscribers'];
$uquery_field[] = 'comments_count';
$uquery_val[] = $array['comments_count'];
$uquery_field[] = 'rating';
$rating = $array['rating'];

View file

@ -2353,11 +2353,23 @@
else
return true;
}elseif($vdo['broadcast']=='private'
&& !$userquery->is_confirmed_friend($vdo['userid'],userid()) && !has_access('video_moderation',true) && $vdo['userid']!=$uid){
&& !$userquery->is_confirmed_friend($vdo['userid'],userid())
&& !has_access('video_moderation',true)
&& $vdo['userid']!=$uid){
e(lang('private_video_error'));
return false;
}else
{
$funcs = cb_get_functions('watch_video');
if($funcs)
foreach($funcs as $func)
{
$data = $func['func']($vdo);
if($data)
return $data;
}
return true;
}
}

View file

@ -1,25 +1,25 @@
<?php
/*
***************************************************************
| Copyright (c) 2007-2010 Clip-Bucket.com. All rights reserved.
| @ Author : ArslanHassan
| @ Software : ClipBucket , © PHPBucket.com
****************************************************************
*/
define('THIS_PAGE','index');
require 'includes/config.inc.php';
$pages->page_redir();
if(is_installed('editorspick'))
{
assign('editor_picks',get_ep_videos());
}
//i love coding :)
//Displaying The Template
template_files('index.html');
display_it();
<?php
/*
***************************************************************
| Copyright (c) 2007-2010 Clip-Bucket.com. All rights reserved.
| @ Author : ArslanHassan
| @ Software : ClipBucket , © PHPBucket.com
****************************************************************
*/
define('THIS_PAGE','index');
require 'includes/config.inc.php';
$pages->page_redir();
if(is_installed('editorspick'))
{
assign('editor_picks',get_ep_videos());
}
//i love coding :)
//Displaying The Template
template_files('index.html');
display_it();
?>

138
upload/js/jquery_plugs/timer.js vendored Normal file
View file

@ -0,0 +1,138 @@
/**
* jQuery.timers - Timer abstractions for jQuery
* Written by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com)
* Licensed under the WTFPL (http://sam.zoy.org/wtfpl/).
* Date: 2009/10/16
*
* @author Blair Mitchelmore
* @version 1.2
*
**/
jQuery.fn.extend({
everyTime: function(interval, label, fn, times) {
return this.each(function() {
jQuery.timer.add(this, interval, label, fn, times);
});
},
oneTime: function(interval, label, fn) {
return this.each(function() {
jQuery.timer.add(this, interval, label, fn, 1);
});
},
stopTime: function(label, fn) {
return this.each(function() {
jQuery.timer.remove(this, label, fn);
});
}
});
jQuery.extend({
timer: {
global: [],
guid: 1,
dataKey: "jQuery.timer",
regex: /^([0-9]+(?:\.[0-9]*)?)\s*(.*s)?$/,
powers: {
// Yeah this is major overkill...
'ms': 1,
'cs': 10,
'ds': 100,
's': 1000,
'das': 10000,
'hs': 100000,
'ks': 1000000
},
timeParse: function(value) {
if (value == undefined || value == null)
return null;
var result = this.regex.exec(jQuery.trim(value.toString()));
if (result[2]) {
var num = parseFloat(result[1]);
var mult = this.powers[result[2]] || 1;
return num * mult;
} else {
return value;
}
},
add: function(element, interval, label, fn, times) {
var counter = 0;
if (jQuery.isFunction(label)) {
if (!times)
times = fn;
fn = label;
label = interval;
}
interval = jQuery.timer.timeParse(interval);
if (typeof interval != 'number' || isNaN(interval) || interval < 0)
return;
if (typeof times != 'number' || isNaN(times) || times < 0)
times = 0;
times = times || 0;
var timers = jQuery.data(element, this.dataKey) || jQuery.data(element, this.dataKey, {});
if (!timers[label])
timers[label] = {};
fn.timerID = fn.timerID || this.guid++;
var handler = function() {
if ((++counter > times && times !== 0) || fn.call(element, counter) === false)
jQuery.timer.remove(element, label, fn);
};
handler.timerID = fn.timerID;
if (!timers[label][fn.timerID])
timers[label][fn.timerID] = window.setInterval(handler,interval);
this.global.push( element );
},
remove: function(element, label, fn) {
var timers = jQuery.data(element, this.dataKey), ret;
if ( timers ) {
if (!label) {
for ( label in timers )
this.remove(element, label, fn);
} else if ( timers[label] ) {
if ( fn ) {
if ( fn.timerID ) {
window.clearInterval(timers[label][fn.timerID]);
delete timers[label][fn.timerID];
}
} else {
for ( var fn in timers[label] ) {
window.clearInterval(timers[label][fn]);
delete timers[label][fn];
}
}
for ( ret in timers[label] ) break;
if ( !ret ) {
ret = null;
delete timers[label];
}
}
for ( ret in timers ) break;
if ( !ret )
jQuery.removeData(element, this.dataKey);
}
}
}
});
jQuery(window).bind("unload", function() {
jQuery.each(jQuery.timer.global, function(index, item) {
jQuery.timer.remove(item);
});
});

View file

@ -63,6 +63,8 @@ if(!function_exists("pak_player"))
preg_match("/\?v\=(.*)/",$ref,$srcs);
$srcs = explode("&",$srcs[1]);
$srcs = $srcs[0];
$srcs = explode("?",$srcs);
$ytcode = $srcs[0];
assign('youtube',true);
assign('ytcode',$ytcode);

View file

@ -65,7 +65,7 @@ flowplayer("the_Video_Player", "{$pak_player_url}/pak_player.swf", {literal}{
youtube :
{literal}
{
url:pakplayer_path+'/flowplayer.youtube-3.2.swf',
url:pakplayer_path+'/pak_player.youtube.swf',
enableGdata: true,
}
{/literal}