From 72f7b7109d1cdf3ec1f5fb022170dedc8c9dc5e1 Mon Sep 17 00:00:00 2001 From: Heshan Date: Fri, 4 Mar 2011 23:20:28 +0530 Subject: Creating presets which can be exported with features, chostools and move subsidary module to modules directory --- plugins/video_zencoder/video_zencoder.module | 151 --------------------------- 1 file changed, 151 deletions(-) delete mode 100644 plugins/video_zencoder/video_zencoder.module (limited to 'plugins/video_zencoder/video_zencoder.module') diff --git a/plugins/video_zencoder/video_zencoder.module b/plugins/video_zencoder/video_zencoder.module deleted file mode 100644 index 7f2218e..0000000 --- a/plugins/video_zencoder/video_zencoder.module +++ /dev/null @@ -1,151 +0,0 @@ - 'Video', -// 'description' => 'Configure different aspects of the video module and its plugins', - 'page callback' => '_video_zencoder_postback_jobs', - 'access arguments' => array('access content'), - 'type' => MENU_CALLBACK, - ); - return $items; -} - -/** - * This will handle Zencoder postback once video conversion is completed - * - */ -function _video_zencoder_postback_jobs() { -// get JSON post data - $data = file_get_contents("php://input"); - watchdog('zencoder', t('Postback received from the Zencoder Transcoding servers.' . serialize($data))); -// print_r($data); -// exit; -// get the file object by zenocder job id - $video = json_decode($data); -// print_r($zc); -// $zc_job_id = $video->job->id; - $zc_job_state = trim($video->job->state); -// $zc_output_id = $video->output->id; - $zc_output_state = trim($video->output->state); -// $zc_output_url = $video->output->url; - if ($zc_output_state == 'finished' && $zc_job_state == 'finished') - $video->output->state = VIDEO_RENDERING_COMPLETE; - if ($zc_output_state == 'failed' || $zc_job_state == 'failed') - $video->output->state = VIDEO_RENDERING_FAILED; - if ($zc_job_state == 'processing') { - watchdog('zencoder', t('Job !jobid is processing.', array('!jobid' => $video->job->id))); - return; - } - -// update the Zencoder Job - module_load_include('inc', 'video_zencoder', '/includes/zencoder'); - $zc = new video_zencoder_api; -// Lets run delete. - $videodb = $zc->load_job($video->job->id); -// print_r($video); -// echo $nid = $videodb->nid; -// echo $vid = $videodb->vid; -// echo $fid = $videodb->fid; - - if ($video->output->state == VIDEO_RENDERING_COMPLETE) { -// echo 'completed'; - $nid = $videodb->nid; - $vid = $videodb->vid; - $fid = $videodb->fid; -// print_r($videodb); -// echo 'working completed'; - if (!db_query('UPDATE {video_zencoder} SET status = %d WHERE vid = %d ', VIDEO_RENDERING_COMPLETE, $vid)) - watchdog('zencoder', t('Error updating zencoder status.', array()), NULL, WATCHDOG_ERROR); - - if (!db_query("UPDATE {node} SET status=%d WHERE nid=%d", 1, $nid)) - watchdog('zencoder', t('Error pulishing node.', array()), NULL, WATCHDOG_ERROR); - -// print_r($video); -// update the thumbanils -// this will update the default thumbnails, if user want to select another one then they wil need to edit the node -// Setup our thmbnail path. - $video_thumb_path = variable_get('video_thumb_path', 'video_thumbs'); - $final_thumb_path = file_default_scheme() . ':/' . $video_thumb_path . '/' . $fid; -// $i = rand(0, (variable_get('no_of_video_thumbs', 5) - 1)); - $filename = $fid . '_' . sprintf("%04d", 1) . '.png'; - $thumbfile = $final_thumb_path . '/' . $filename; - - if (video_s3_get_object_info($thumbfile)) { - $default = $final_thumb_path . '/no-thumb.png'; - file_delete($default); - if (video_s3_get_object($thumbfile, $default)) - watchdog('zencoder', t('Successfully downloaded the thumbnails file and replaced the default image.')); - else - watchdog('zencoder', t('Download thumbanils files is failed.'), array(), WATCHDOG_ERROR); - } -// file_copy($default, $thumbfile, FILE_EXISTS_REPLACE); - watchdog('zencoder', t('Updated the Zencoder Job !id to states !states.', array('!id' => $video->job->id, '!states' => $zc_output_state))); - } - else if ($video->output->state == VIDEO_RENDERING_FAILED) { - echo 'working failed'; - $this->change_status($vid, VIDEO_RENDERING_FAILED); - watchdog('zencoder', t('Zencoder job failed converting videos, please login to zencoder web and check the erros.', array()), NULL, WATCHDOG_ERROR); - } else { - echo 'working something else'; - } -} - -/** - * Implementation of hook_mail(). - */ -function video_zencoder_mail($key, &$message, $params) { - $language = $message['language']; - $message['subject'] .= 'Zencoder Registration Details for Drupal Video'; - $message['body'][] = video_zencoder_mail_default($params); -} - -function video_zencoder_mail_default($params) { - return t( - 'Welcome to Zencoder for Drupal -------------------------------- - -Your account has been created and is ready to start processing. - -Your account details are as below. - -API Key : %api_key -Password : %password - -* Login URL: https://app.zencoder.com/login - -You can get help at the following places: - -* Our chat room at http://zencoder.com/chat -* Customer forums at https://help.zencoder.com/forums -* The help desk at https://help.zencoder.com/tickets/new - -We\'d love to hear from you. Let us know how we can help. Thanks! - -Thanks, --Zencoder for Drupal Team', array('%api_key' => $params['api_key'], '%password' => $params['password'])); -} - -- cgit v1.2.3