Results 1 to 10 of 18

Thread: Duration problem

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #8
    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.

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
  •