Results 1 to 10 of 18

Thread: Duration problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2009
    Posts
    71

    Default

    This will fix the duration problem.

    Open admin/video_add_flv_2.php

    find the code
    Code:
    $sql = "INSERT INTO `videos` SET
                   `video_user_id`=" . (int) $video_user_id . ",
                   `video_title`='" . mysql_clean($video_title) . "',
                   `video_description`='" . mysql_clean($video_description) . "',
                   `video_keywords`='" . mysql_clean($upload_video_keywords) . "',
                   `video_seo_name`='" . seo_name($video_title) . "',
                   `video_embed_code`='" . mysql_clean($embed_code) . "',
                   `video_channels`='0|$video_channels|0',
                   `video_type`='$video_type',
                   `video_vtype`=$vtype,
                   `video_adult`='$video_adult',
                   `video_duration`=1,
                   `video_length`='01:00',
                   `video_add_time`='" . time() . "',
                   `video_add_date`='" . date("Y-m-d") . "',
                   `video_active`='1',
                   `video_approve`='$config[approve]'";
    replace it with

    Code:
    $video_duration = '1';
            $video_length = '01:00';
            
            if (preg_match("/youtube/i", $embed_code))
            {
                if (preg_match('/v\/(.[a-zA-Z0-9]+)/i', $embed_code, $matches) || preg_match('/v=(.[a-zA-Z0-9]+)/i', $embed_code, $matches))
                {
                    if (isset($matches[1]))
                    {
                        require_once '../include/class.bulk_import.php';
                        require 'Zend/Loader.php';
                        Zend_Loader::loadClass('Zend_Gdata_YouTube');
                        
                        $matches_arr = explode('&', $matches[1]);
                        $youtube_video_id = $matches_arr[0];
                        
                        $youtube_video_info =     BulkImport::getYoutubeVideoInfo($youtube_video_id);
                        
                        $video_duration = $youtube_video_info['video_duration'];
                        $video_length = sec2hms($youtube_video_info['video_duration']);
                    }
                }
            }
            
            $sql = "INSERT INTO `videos` SET
                   `video_user_id`=" . (int) $video_user_id . ",
                   `video_title`='" . mysql_clean($video_title) . "',
                   `video_description`='" . mysql_clean($video_description) . "',
                   `video_keywords`='" . mysql_clean($upload_video_keywords) . "',
                   `video_seo_name`='" . seo_name($video_title) . "',
                   `video_embed_code`='" . mysql_clean($embed_code) . "',
                   `video_channels`='0|$video_channels|0',
                   `video_type`='$video_type',
                   `video_vtype`=$vtype,
                   `video_adult`='$video_adult',
                   `video_duration`='" . (int) $video_duration . "',
                   `video_length`='" . mysql_clean($video_length) . "',
                   `video_add_time`='" . time() . "',
                   `video_add_date`='" . date("Y-m-d") . "',
                   `video_active`='1',
                   `video_approve`='$config[approve]'";
    Thanks.
    Last edited by vshare; 09-04-2010 at 08:39 AM.

  2. #2
    Join Date
    Jul 2010
    Posts
    14

    Default

    Thank you! :)

    I will try .

  3. #3
    Join Date
    Sep 2010
    Posts
    15

    Default Still runtimes show as 1:00

    Quote Originally Posted by vshare View Post
    This will fix the duration problem.

    Open admin/video_add_flv_2.php

    find the code
    Code:
    $sql = "INSERT INTO `videos` SET
                   `video_user_id`=" . (int) $video_user_id . ",
                   `video_title`='" . mysql_clean($video_title) . "',
                   `video_description`='" . mysql_clean($video_description) . "',
                   `video_keywords`='" . mysql_clean($upload_video_keywords) . "',
                   `video_seo_name`='" . seo_name($video_title) . "',
                   `video_embed_code`='" . mysql_clean($embed_code) . "',
                   `video_channels`='0|$video_channels|0',
                   `video_type`='$video_type',
                   `video_vtype`=$vtype,
                   `video_adult`='$video_adult',
                   `video_duration`=1,
                   `video_length`='01:00',
                   `video_add_time`='" . time() . "',
                   `video_add_date`='" . date("Y-m-d") . "',
                   `video_active`='1',
                   `video_approve`='$config[approve]'";
    replace it with

    Code:
    $video_duration = '1';
            $video_length = '01:00';
            
            if (preg_match("/youtube/i", $embed_code))
            {
                if (preg_match('/v=(.*)/i', $embed_code, $matches))
                {
                    if (isset($matches[1]))
                    {
                        require_once '../include/class.bulk_import.php';
                        require 'Zend/Loader.php';
                        Zend_Loader::loadClass('Zend_Gdata_YouTube');
                        
                        $matches_arr = explode('&', $matches[1]);
                        $youtube_video_id = $matches_arr[0];
                        
                        $youtube_video_info =     BulkImport::getYoutubeVideoInfo($youtube_video_id);
                        
                        $video_duration = $youtube_video_info['video_duration'];
                        $video_length = sec2hms($youtube_video_info['video_duration']);
                    }
                }
            }
            
            $sql = "INSERT INTO `videos` SET
                   `video_user_id`=" . (int) $video_user_id . ",
                   `video_title`='" . mysql_clean($video_title) . "',
                   `video_description`='" . mysql_clean($video_description) . "',
                   `video_keywords`='" . mysql_clean($upload_video_keywords) . "',
                   `video_seo_name`='" . seo_name($video_title) . "',
                   `video_embed_code`='" . mysql_clean($embed_code) . "',
                   `video_channels`='0|$video_channels|0',
                   `video_type`='$video_type',
                   `video_vtype`=$vtype,
                   `video_adult`='$video_adult',
                   `video_duration`='" . (int) $video_duration . "',
                   `video_length`='" . mysql_clean($video_length) . "',
                   `video_add_time`='" . time() . "',
                   `video_add_date`='" . date("Y-m-d") . "',
                   `video_active`='1',
                   `video_approve`='$config[approve]'";
    Thanks.

    I changed the code as shown above but still the runtime of video in "videos being watched......" and in "new videos" section as well , runtimes appear as 1:00 . Pls help in changing the code so that actual runtimes of the video appear on the video. thanks in advance.

  4. #4
    Join Date
    Dec 2009
    Posts
    71

    Default

    I have changed the above code i added (http://forums.buyscripts.in/frequent...html#post23035). Please try again.

    Thanks.

  5. #5
    Join Date
    Sep 2010
    Posts
    15

    Default

    thanks vshare . It is working fine now. Could you please tell me what u did to sort it out so that i won't have to bug you again when i buy more vshare scripts.

    I read somewhere , some one saying that vshare is picking up on other scripts. Vshare is already ahead of all other scripts, i have used many and none works like this and not to mention the support. Many don't work out of the box , too expensive and all that.
    THANKS

  6. #6
    Join Date
    Jul 2010
    Posts
    14

    Default

    Not working for me :(

    old:
    <?php
    /************************************************** ****************************
    *
    * COMPANY: BuyScripts.in
    * PROJECT: vShare Youtube Clone
    * VERSION: 2.7
    * LISENSE: http://buyscripts.in/vshare-license.html
    * WEBSITE: http://buyscripts.in/youtube_clone.html
    *
    * This program is a commercial software and any kind of using it must agree
    * to vShare license.
    *
    ************************************************** ****************************/

    require '../include/config.php';
    require '../include/functions_seo_name.php';
    require '../include/class.tags.php';
    require '../include/class.video_thumb.php';
    require '../include/language/' . LANG . '/lang_admin_video_add_flv_2.php';

    check_admin_login();

    $success = 0;

    if (isset($_SESSION['keywords']))
    {
    $upload_video_keywords = $_SESSION['keywords'];
    }
    else
    {
    $err = $lang['keywords_empty'];
    }

    if (isset($_SESSION['title']))
    {
    $video_title = $_SESSION['title'];
    }
    else
    {
    $err = $lang['title_empty'];
    }

    if (isset($_SESSION['description']))
    {
    $video_description = $_SESSION['description'];
    }
    else
    {
    $err = $lang['description_empty'];
    }

    if (isset($_SESSION['channels']))
    {
    $video_channels = $_SESSION['channels'];
    }
    else
    {
    $err = $lang['channels_empty'];
    }

    if (isset($_SESSION['video_privacy']))
    {
    $video_type = $_SESSION['video_privacy'];
    }
    else
    {
    $err = $lang['type_empty'];
    }

    if (isset($_SESSION['user_id']))
    {
    $video_user_id = $_SESSION['user_id'];
    }
    else
    {
    $err = $lang['userid_not_set'];
    }

    if ($err != '')
    {
    set_message($err, 'error');
    $redirect_url = VSHARE_URL . '/admin/video_add_flv.php';
    redirect($redirect_url);
    }

    if (isset($_POST['submit']))
    {
    $video_adult = isset($_SESSION['adult']) ? $_SESSION['adult'] : 0;
    $embed_code = isset($_POST['embed_code']) ? $_POST['embed_code'] : '';
    $flv_url = isset($_POST['flv_url']) ? $_POST['flv_url'] : '';

    if ($embed_code == '' && $flv_url == '')
    {
    $err = $lang['url_embed_empty'];
    }
    else if (! isset($_POST['embedded_code_image']) && ! isset($_POST['embedded_code_image_local']))
    {
    $err = $lang['specify_image'];
    }

    if ($err == '')
    {

    if (strlen($flv_url) > 30)
    {
    $vtype = 2;
    $embed_code = $flv_url;
    }
    else
    {
    $vtype = 6;
    }

    $sql = "INSERT INTO `videos` SET
    `video_user_id`=" . (int) $video_user_id . ",
    `video_title`='" . mysql_clean($video_title) . "',
    `video_description`='" . mysql_clean($video_description) . "',
    `video_keywords`='" . mysql_clean($upload_video_keywords) . "',
    `video_seo_name`='" . seo_name($video_title) . "',
    `video_embed_code`='" . mysql_clean($embed_code) . "',
    `video_channels`='0|$video_channels|0',
    `video_type`='$video_type',
    `video_vtype`=$vtype,
    `video_adult`='$video_adult',
    `video_duration`=1,
    `video_length`='01:00',
    `video_add_time`='" . time() . "',
    `video_add_date`='" . date("Y-m-d") . "',
    `video_active`='1',
    `video_approve`='$config[approve]'";

    $result = mysql_query($sql) or mysql_die($sql);
    $video_id = mysql_insert_id();

    if ($video_type == 'public' && $config['approve'] == 1)
    {
    $current_keyword = mysql_clean($upload_video_keywords);
    $tags = new Tags($current_keyword, $video_id, $video_user_id, $video_channels);
    $tags->add();
    }

    if (! empty($_POST['embedded_code_image'][0]))
    {
    $embedded_image = $_POST['embedded_code_image'];
    $destination = VSHARE_DIR . '/thumb/' . $video_id . '.jpg';
    $source = $embedded_image[0];
    download($source, $destination);

    //$limit = count($embedded_image);
    $j = 0;
    for ($i = 0; $i < 3; $i ++)
    {
    $j ++;
    if (! empty($embedded_image[$i]) && strstr($embedded_image[$i], '.jpg'))
    {
    $destination = VSHARE_DIR . '/thumb/' . $j . '_' . $video_id . '.jpg';
    echo '<br />';
    $source = $embedded_image[$i];
    download($source, $destination);
    }
    else
    {
    $destination = VSHARE_DIR . '/thumb/' . $j . '_' . $video_id . '.jpg';
    copy(VSHARE_DIR . '/templates/images/no_thumbnail.gif', $destination);
    }
    }
    }
    else if (! empty($_FILES['embedded_code_image_local']['tmp_name'][0]))
    {
    $fd = VSHARE_DIR . '/thumb/' . $video_id . '.jpg';
    $maxwidth = $config['img_max_width'];
    $maxheight = $config['img_max_height'];
    video_thumb::create_thumb($_FILES['embedded_code_image_local']['tmp_name'][0], $fd, $maxwidth, $maxheight);

    //$limit = count($_FILES['embedded_code_image_local']['name']);
    $j = 0;
    for ($i = 0; $i < 3; $i ++)
    {
    $j ++;
    if (! empty($_FILES['embedded_code_image_local']['name'][$i]) && ($_FILES['embedded_code_image_local']['type'][$i] == "image/jpeg"))
    {
    $fd = VSHARE_DIR . '/thumb/' . $j . '_' . $video_id . '.jpg';
    video_thumb::create_thumb($_FILES['embedded_code_image_local']['tmp_name'][$i], $fd, $maxwidth, $maxheight);
    }
    else
    {
    copy(VSHARE_DIR . '/templates/images/no_thumbnail.gif', VSHARE_DIR . '/thumb/' . $j . '_' . $video_id . '.jpg');
    }
    }
    }

    $msg = $lang['video_added'];
    $success = 1;
    }
    }

    $smarty->assign('success', $success);
    $smarty->assign('err', $err);
    $smarty->assign('msg', $msg);
    $smarty->display('admin/header.tpl');
    $smarty->display('admin/video_add_flv_2.tpl');
    $smarty->display('admin/footer.tpl');
    db_close();
    Last edited by vvv; 09-04-2010 at 08:49 PM.

  7. #7
    Join Date
    Sep 2010
    Posts
    15

    Default

    what file is that and where is it located? I can compare it with mine and see if there are any changes in the file and i can tell you what is different. Just let me know the file name of the above file.

  8. #8
    Join Date
    Jul 2010
    Posts
    14

    Default

    admin\video_add_flv_2.php

  9. #9
    Join Date
    May 2007
    Location
    Planet Earth
    Posts
    1,389

    Default

    Same problem with vshare 2.8. When I embed videos, they are all @ 1:00 time. Is there a fix for 2.8 beta?
    If it's not fun, stop doing it!

  10. #10
    Join Date
    Sep 2010
    Posts
    15

    Default

    Sorry VVV couldn't reply earlier.

    Here is my admin/video__add_flv_2.php


    <?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/functions_seo_name.php';
    require '../include/class.tags.php';
    require '../include/class.video_thumb.php';
    require '../include/language/' . LANG . '/lang_admin_video_add_flv_2.php';

    check_admin_login();

    $success = 0;

    if (isset($_SESSION['keywords']))
    {
    $upload_video_keywords = $_SESSION['keywords'];
    }
    else
    {
    $err = $lang['keywords_empty'];
    }

    if (isset($_SESSION['title']))
    {
    $video_title = $_SESSION['title'];
    }
    else
    {
    $err = $lang['title_empty'];
    }

    if (isset($_SESSION['description']))
    {
    $video_description = $_SESSION['description'];
    }
    else
    {
    $err = $lang['description_empty'];
    }

    if (isset($_SESSION['channels']))
    {
    $video_channels = $_SESSION['channels'];
    }
    else
    {
    $err = $lang['channels_empty'];
    }

    if (isset($_SESSION['video_privacy']))
    {
    $video_type = $_SESSION['video_privacy'];
    }
    else
    {
    $err = $lang['type_empty'];
    }

    if (isset($_SESSION['user_id']))
    {
    $video_user_id = $_SESSION['user_id'];
    }
    else
    {
    $err = $lang['userid_not_set'];
    }

    if ($err != '')
    {
    set_message($err, 'error');
    $redirect_url = VSHARE_URL . '/admin/video_add_flv.php';
    redirect($redirect_url);
    }

    if (isset($_POST['submit']))
    {
    $video_adult = isset($_SESSION['adult']) ? $_SESSION['adult'] : 0;
    $embed_code = isset($_POST['embed_code']) ? $_POST['embed_code'] : '';
    $flv_url = isset($_POST['flv_url']) ? $_POST['flv_url'] : '';

    if ($embed_code == '' && $flv_url == '')
    {
    $err = $lang['url_embed_empty'];
    }
    else if (! isset($_POST['embedded_code_image']) && ! isset($_POST['embedded_code_image_local']))
    {
    $err = $lang['specify_image'];
    }

    if ($err == '')
    {

    if (strlen($flv_url) > 30)
    {
    $vtype = 2;
    $embed_code = $flv_url;
    }
    else
    {
    $vtype = 6;
    }

    $video_duration = '1';
    $video_length = '01:00';

    if (preg_match("/youtube/i", $embed_code))
    {
    if (preg_match('/v\/(.[a-zA-Z0-9]+)/i', $embed_code, $matches) || preg_match('/v=(.[a-zA-Z0-9]+)/i', $embed_code, $matches))
    {
    if (isset($matches[1]))
    {
    require_once '../include/class.bulk_import.php';
    require 'Zend/Loader.php';
    Zend_Loader::loadClass('Zend_Gdata_YouTube');

    $matches_arr = explode('&', $matches[1]);
    $youtube_video_id = $matches_arr[0];

    $youtube_video_info = BulkImport::getYoutubeVideoInfo($youtube_video_id) ;

    $video_duration = $youtube_video_info['video_duration'];
    $video_length = sec2hms($youtube_video_info['video_duration']);
    }
    }
    }

    $sql = "INSERT INTO `videos` SET
    `video_user_id`=" . (int) $video_user_id . ",
    `video_title`='" . mysql_clean($video_title) . "',
    `video_description`='" . mysql_clean($video_description) . "',
    `video_keywords`='" . mysql_clean($upload_video_keywords) . "',
    `video_seo_name`='" . seo_name($video_title) . "',
    `video_embed_code`='" . mysql_clean($embed_code) . "',
    `video_channels`='0|$video_channels|0',
    `video_type`='$video_type',
    `video_vtype`=$vtype,
    `video_adult`='$video_adult',
    `video_duration`='" . (int) $video_duration . "',
    `video_length`='" . mysql_clean($video_length) . "',
    `video_add_time`='" . time() . "',
    `video_add_date`='" . date("Y-m-d") . "',
    `video_active`='1',
    `video_approve`='$config[approve]'";

    $result = mysql_query($sql) or mysql_die($sql);
    $video_id = mysql_insert_id();

    if ($video_type == 'public' && $config['approve'] == 1)
    {
    $current_keyword = mysql_clean($upload_video_keywords);
    $tags = new Tags($current_keyword, $video_id, $video_user_id, $video_channels);
    $tags->add();
    }

    if (! empty($_POST['embedded_code_image'][0]))
    {
    $embedded_image = $_POST['embedded_code_image'];
    $destination = VSHARE_DIR . '/thumb/' . $video_id . '.jpg';
    $source = $embedded_image[0];
    download($source, $destination);

    //$limit = count($embedded_image);
    $j = 0;
    for ($i = 0; $i < 3; $i ++)
    {
    $j ++;
    if (! empty($embedded_image[$i]) && strstr($embedded_image[$i], '.jpg'))
    {
    $destination = VSHARE_DIR . '/thumb/' . $j . '_' . $video_id . '.jpg';
    echo '<br />';
    $source = $embedded_image[$i];
    download($source, $destination);
    }
    else
    {
    $destination = VSHARE_DIR . '/thumb/' . $j . '_' . $video_id . '.jpg';
    copy(VSHARE_DIR . '/templates/images/no_thumbnail.gif', $destination);
    }
    }
    }
    else if (! empty($_FILES['embedded_code_image_local']['tmp_name'][0]))
    {
    $fd = VSHARE_DIR . '/thumb/' . $video_id . '.jpg';
    $maxwidth = $config['img_max_width'];
    $maxheight = $config['img_max_height'];
    video_thumb::create_thumb($_FILES['embedded_code_image_local']['tmp_name'][0], $fd, $maxwidth, $maxheight);

    //$limit = count($_FILES['embedded_code_image_local']['name']);
    $j = 0;
    for ($i = 0; $i < 3; $i ++)
    {
    $j ++;
    if (! empty($_FILES['embedded_code_image_local']['name'][$i]) && ($_FILES['embedded_code_image_local']['type'][$i] == "image/jpeg"))
    {
    $fd = VSHARE_DIR . '/thumb/' . $j . '_' . $video_id . '.jpg';
    video_thumb::create_thumb($_FILES['embedded_code_image_local']['tmp_name'][$i], $fd, $maxwidth, $maxheight);
    }
    else
    {
    copy(VSHARE_DIR . '/templates/images/no_thumbnail.gif', VSHARE_DIR . '/thumb/' . $j . '_' . $video_id . '.jpg');
    }
    }
    }

    $msg = $lang['video_added'];
    $success = 1;
    }
    }

    $smarty->assign('success', $success);
    $smarty->assign('err', $err);
    $smarty->assign('msg', $msg);
    $smarty->display('admin/header.tpl');
    $smarty->display('admin/video_add_flv_2.tpl');
    $smarty->display('admin/footer.tpl');
    db_close();

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •