exit(json_encode(array('error' => error('single')))); } if (!function_exists('get_refer_url_from_embed_code')) { exit(json_encode(array('error' => "Clipbucket embed module is not installed"))); } $ref_url = get_refer_url_from_embed_code(unhtmlentities(stripslashes($vdetails['embed_code']))); $ref_url = $ref_url['url']; $db->update(tbl("video"), array("status", "refer_url", "duration"), array('Successful', $ref_url, $duration), " videoid='{$vid}'"); //Downloading thumb foreach ($vid_array['thumbs'] as $tid => $thumb) { if ($tid != 'big') { $thumbId = $tid + 1; } else { $thumbId = 'big'; } snatch_it(urlencode($thumb), THUMBS_DIR, $filename . "-{$thumbId}.jpg"); } exit(json_encode(array('vid' => $vid, 'title' => $vid_array['title'], 'desc' => $vid_array['description'], 'tags' => $vid_array['tags']))); } function callback($download_size, $downloaded, $upload_size, $uploaded) { global $curl, $log_file, $file_name, $ext; $fo = fopen($log_file, 'w+'); //Elapsed time CURLINFO_TOTAL_TIME $info = curl_getinfo($curl->m_handle); $download_bytes = $download_size - $downloaded; $cur_speed = $info['speed_download']; if ($cur_speed > 0) { $time_eta = $download_bytes / $cur_speed; } else { $time_eta = 0;
//exit(json_encode(array('error'=>error('single')))); } if (!function_exists('get_refer_url_from_embed_code')) { exit(json_encode(array('error' => "Clipbucket embed module is not installed"))); } $ref_url = get_refer_url_from_embed_code(unhtmlentities(stripslashes($vdetails['embed_code']))); $ref_url = $ref_url['url']; $db->update(tbl("video"), array("status", "refer_url", "duration"), array('Successful', $ref_url, $duration), " videoid='{$vid}'"); //Downloading thumb foreach ($vid_array['thumbs'] as $tid => $thumb) { if ($tid != 'big') { $thumbId = $tid + 1; } else { $thumbId = 'big'; } snatch_it(urlencode($thumb), THUMBS_DIR . '/' . $file_directory, $filename . "-{$thumbId}.jpg"); } exit(json_encode(array('youtubeID' => $YouTubeId, 'vid' => $vid, 'title' => $vid_array['title'], 'desc' => $vid_array['description'], 'tags' => $vid_array['tags']))); } $logDetails = array(); /* A callback accepting five parameters. The first is the cURL resource, the second is the total number of bytes expected to be downloaded in this transfer, the third is the number of bytes downloaded so far, the fourth is the total number of bytes expected to be uploaded in this transfer, and the fifth is the number of bytes uploaded so far. */ function callback($resource, $download_size, $downloaded, $upload_size, $uploaded) { global $curl, $log_file, $file_name, $ext, $logDetails; $fo = fopen($log_file, 'w+');