Results 1 to 10 of 20

Thread: Runtimes on videos show 1:00

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2010
    Location
    Pokhara Nepal
    Posts
    49

    Default Thanks it works

    Quote Originally Posted by vshare2 View Post
    This is the full source code of admin/import_bulk_process.php(v2.7)
    Code:
    <?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/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`='" . (int) $video_info['video_duration'] . "',
                               `video_length`='" . mysql_clean($video_length) . "',
                               `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);
    }
    Try this,

    Thanks
    The above code works like champ thank you.
    Nepal's Largest video community portal. share wisely at WWW.CLONEVIDEOS.COM

  2. #2
    Join Date
    Jan 2008
    Posts
    216

    Default

    Similar fix need to be done also for upload_remote.php ;)

  3. #3
    Join Date
    Sep 2010
    Location
    Pokhara Nepal
    Posts
    49

    Default

    Quote Originally Posted by ramius View Post
    Similar fix need to be done also for upload_remote.php ;)
    yah you are right, but how to change? can you please help?
    Nepal's Largest video community portal. share wisely at WWW.CLONEVIDEOS.COM

  4. #4
    Join Date
    Sep 2010
    Posts
    20

    Default

    Quote Originally Posted by clonevideos View Post
    yah you are right, but how to change? can you please help?

    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); 

  5. #5
    Join Date
    Jan 2008
    Posts
    216

    Default

    I was working on it but you were faster, your code is working fine.
    Thanks!

  6. #6
    Join Date
    Sep 2010
    Location
    Pokhara Nepal
    Posts
    49

    Default thank you for the great help

    Quote Originally Posted by tientuy View Post
    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.
    Nepal's Largest video community portal. share wisely at WWW.CLONEVIDEOS.COM

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
  •