Runtimes on videos show 1:00
RUntimes of videos on home page show 1:00. When i was mass embedding from youtube , it showed correct run times.
I changed the code as it says in this thread http://forums.buyscripts.in/frequent...n-problem.html
but it has not solved the problem. DOes anyone have a solution to this problem?. I can't seem to find a solution on the forum yet, unless i missed the right threads.
thanks in advance
but it did not work and i saw some times mentioned in the other variables.
Quote:
Originally Posted by
vshare2
This will fix the duration problem of Bulk import (v2.7).
Open admin/import_bulk_process.php
Add this code:
Code:
$video_length = sec2hms($video_info['video_duration']);
after
Code:
$seo_name = seo_name($video_info['video_title']);
Thanks.
i used thsi code and tried but still the same. there is time mentioned in some variables in the same php file please check the code below. do we need to get new code? for this file or still the same?
codes:
Code:
<?php
/******************************************************************************
*
* COMPANY: BuyScripts.in
* PROJECT: vShare Youtube Clone
* VERSION: 2.7
* LISENSE: vShare YouTube Clone License Agreement
* WEBSITE: vShare Video Sharing Script, YouTube Clone Script
*
* This program is a commercial software and any kind of using it must agree
* to vShare license.
*
******************************************************************************/
require '../include/config.php';
require '../include/class.upload_remote.php';
require '../include/functions_seo_name.php';
require '../include/class.tags.php';
require '../include/class.bulk_import.php';
require '../include/youtube.php';
require 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_YouTube');
check_admin_login();
$imported_sites = array(
'youtube'
);
if (isset($_POST['submit']))
{
$video_id = isset($_POST['video_id']) ? $_POST['video_id'] : array();
$user_name = isset($_POST['user_name']) ? $_POST['user_name'] : '';
$channel_id = isset($_POST['channel_id']) ? (int) $_POST['channel_id'] : 0;
$sql = "SELECT * FROM `users` AS u,`channels` AS c WHERE
u.user_name='" . mysql_clean($user_name) . "' AND
c.channel_id='" . (int) $channel_id . "'";
$result = mysql_query($sql) or mysql_die($sql);
if (mysql_num_rows($result) > 0)
{
$tmp = mysql_fetch_assoc($result);
$user_id = $tmp['user_id'];
for ($i = 0; $i < count($video_id); $i ++)
{
if (! BulkImport::checkImported($video_id[$i], $_POST['import_site']) && in_array($_POST['import_site'], $imported_sites))
{
$sql = "INSERT INTO `import_track` SET
`import_track_unique_id`='" . mysql_clean($video_id[$i]) . "' ,
`import_track_site`='" . mysql_clean($_POST['import_site']) . "'";
$result = mysql_query($sql) or mysql_die($sql);
if ($_POST['import_site'] == 'youtube')
{
$video_url = 'http://www.youtube.com/watch?v=' . $video_id[$i];
$video_info = BulkImport::getYoutubeVideoInfo($video_id[$i]);
}
if ($_POST['import_method'] == 'embed')
{
$video_length = sec2hms($video_info['video_duration']);
$seo_name = seo_name($video_info['video_title']);
$sql = "INSERT INTO `videos` SET
`video_user_id`='" . (int) $user_id . "',
`video_title`='" . mysql_clean($video_info['video_title']) . "',
`video_description`='" . mysql_clean($video_info['video_description']) . "',
`video_keywords`='" . mysql_clean($video_info['video_keywords']) . "',
`video_seo_name`='" . mysql_clean($seo_name) . "',
`video_channels`='0|" . mysql_clean($channel_id) . "|0',
`video_type`='" . mysql_clean('public') . "',
`video_duration`=1,
`video_length`='01:00',
`video_add_time`='" . $_SERVER['REQUEST_TIME'] . "',
`video_add_date`='" . date('Y-m-d') . "',
`video_active`='1',
`video_approve`='$config[approve]'";
$result = mysql_query($sql) or mysql_die($sql);
$vid = mysql_insert_id();
$upload = new upload_remote();
$upload->vid = $vid;
$upload->url = $video_url;
$upload->debug = 1;
if ($config['approve'] == 1)
{
$current_keyword = mysql_clean($video_info['video_keywords']);
$tags = new Tags($video_info['video_keywords'], $vid, $user_id, "0|$channel_id|0");
$tags->add();
$video_tags = $tags->get_tags();
$sql = "UPDATE `videos` SET
`video_keywords`='" . mysql_clean(implode(' ',$video_tags)) . "' WHERE
`video_id`='" . (int) $vid . "'";
mysql_query($sql) or mysql_die($sql);
}
if ($_POST['import_site'] == 'youtube')
{
$upload->youtube();
}
}
else
{
$sql = "INSERT INTO `process_queue`SET
`user`='" . mysql_clean($user_name) . "',
`title`='" . mysql_clean($video_info['video_title']) . "',
`description`='" . mysql_clean($video_info['video_description']) . "',
`keywords`='" . mysql_clean($video_info['video_keywords']) . "',
`process_queue_upload_ip`='" . User::get_ip() . "',
`type`='public',
`channels`='0|" . mysql_clean($channel_id) . "|0',
`status`='0',
`url`='" . mysql_clean($video_url) . "'";
$result = mysql_query($sql) or mysql_die($sql);
}
}
}
}
$keyword = isset($_POST['keyword']) ? $_POST['keyword'] : '';
$page = isset($_POST['page']) ? (int) $_POST['page'] : 1;
$redirect_url = VSHARE_URL . '/admin/import_bulk.php?keyword=' . $keyword . '&user_name=' . $user_name . '&channel=' . $channel_id . '&page=' . $page;
redirect($redirect_url);
}
This is the code in my server currently. please help.
thank you for the great help
Quote:
Originally Posted by
tientuy
try this ( just tested for youtube)
open include/class.upload_remote.php
Find :
PHP Code:
$youtube_xml = $this->get_youtube_duration('http://www.youtube.com/api2_rest?method=youtube.videos.get_details&dev_id=rG48P7iz0eo&video_id=' . $this->video_id);
preg_match('/<length_seconds>(.*)<\/length_seconds>/i', $youtube_xml, $duration);
if (isset($duration[1]))
{
$youtube_duration = $duration[1];
$youtube_video_time = sec2hms($youtube_duration);
$this->update_youtube_duration($youtube_video_time, $youtube_duration);
}
Replace it by :
PHP Code:
/*
$youtube_xml = $this->get_youtube_duration('http://www.youtube.com/api2_rest?method=youtube.videos.get_details&dev_id=rG48P7iz0eo&video_id=' . $this->video_id);
preg_match('/<length_seconds>(.*)<\/length_seconds>/i', $youtube_xml, $duration);
if (isset($duration[1]))
{
$youtube_duration = $duration[1];
$youtube_video_time = sec2hms($youtube_duration);
$this->update_youtube_duration($youtube_video_time, $youtube_duration);
}
*/
require 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata_YouTube');
require 'class.bulk_import.php';
$temp = BulkImport::getYoutubeVideoInfo($video_id);
$youtube_duration=$temp['video_duration'];
$youtube_video_time=sec2hms($youtube_duration);
if( $youtube_duration )
$this->update_youtube_duration($youtube_video_time, $youtube_duration);
the codes above works best. thank you for your hard work. Appriciated.