From aa5c9b48cfa5674f534acab2cdaab685e9e116ee Mon Sep 17 00:00:00 2001 From: Heshan Date: Wed, 4 May 2011 17:16:42 +0530 Subject: Run through the coder module and review the code and documentation of the module code. --- modules/video_zencoder/includes/zencoder.inc | 17 ++++++++++------- modules/video_zencoder/transcoders/video_zencoder.inc | 8 +++++--- modules/video_zencoder/video_zencoder.module | 3 ++- 3 files changed, 17 insertions(+), 11 deletions(-) (limited to 'modules/video_zencoder') diff --git a/modules/video_zencoder/includes/zencoder.inc b/modules/video_zencoder/includes/zencoder.inc index 09109a2..f898479 100644 --- a/modules/video_zencoder/includes/zencoder.inc +++ b/modules/video_zencoder/includes/zencoder.inc @@ -180,16 +180,17 @@ class video_zencoder_api { // Check if it worked if ($encoding_job->created) { return $encoding_job; - } else { + } + else { foreach ($encoding_job->errors as $error) { watchdog('zencoder', 'Zencoder reports some errors. !error', array('!error' => $error), WATCHDOG_ERROR); } - return false; + return FALSE; } } /* - * Verifies the existence of a file id, returns the row or false if none found. + * Verifies the existence of a file id, returns the row or FALSE if none found. */ public function load_job($jobid) { @@ -209,7 +210,7 @@ class video_zencoder_api { $request = new ZencoderRequest( 'https://app.zencoder.com/api/account', - false, // API key isn't needed for new account creation + FALSE, // API key isn't needed for new account creation array( "terms_of_service" => "1", "email" => $user->email, @@ -223,14 +224,16 @@ class video_zencoder_api { $message = drupal_mail('video_zencoder', 'video_zencoder', $user->email, language_default(), $results); if (!$message['result']) { drupal_set_message(t('Unable to send e-mail!. Your Zencoder Details are as below.
API Key : !api_key
Password : !password
', array('!api_key' => $results['api_key'], '!password' => $results['password'])), 'status'); - } else { + } + else { // drupal_mail('video_zencoder', 'video_zencoder', 'heshanmw@gmail.com', language_default(), $results); drupal_set_message(t('Your account has been created and is ready to start processing on Zencoder')); } // return $request->results; - return true; + return TRUE; // variable_set('video_zencoder_api_key', ''); - } else { + } + else { $errors = ''; foreach ($request->errors as $error) { if ($error == 'Email has already been taken') { diff --git a/modules/video_zencoder/transcoders/video_zencoder.inc b/modules/video_zencoder/transcoders/video_zencoder.inc index e629155..eb93fba 100644 --- a/modules/video_zencoder/transcoders/video_zencoder.inc +++ b/modules/video_zencoder/transcoders/video_zencoder.inc @@ -100,7 +100,8 @@ class video_zencoder implements transcoder_interface { if ($this->update($video)) { watchdog('zencoder', t('Successfully created trancoding job on !jobid.', array('!jobid' => $video->jobid)), array(), WATCHDOG_INFO); } - } else { + } + else { watchdog('zencoder', 'Failed to queus our file to Zencoder.', array(), WATCHDOG_ERROR); $this->change_status($video->vid, VIDEO_RENDERING_FAILED); return FALSE; @@ -168,7 +169,8 @@ class video_zencoder implements transcoder_interface { '#title' => t('Agree Zencoder !link.', array('!link' => l(t('Terms and Conditions'), 'http://zencoder.com/terms', array('attributes' => array('target' => '_blank'))))), '#default_value' => variable_get('agree_terms_zencoder', TRUE), ); - } else { + } + else { // Zencoder API is exists $form['zencoder_info'] = array( '#type' => 'fieldset', @@ -237,7 +239,7 @@ class video_zencoder implements transcoder_interface { $user = new stdClass; $user->email = $email; $result = $zc->create_user($user); - if ($result !== true) + if ($result !== TRUE) form_set_error('zencoder_username', $result); } } diff --git a/modules/video_zencoder/video_zencoder.module b/modules/video_zencoder/video_zencoder.module index 93735c0..2343bc8 100644 --- a/modules/video_zencoder/video_zencoder.module +++ b/modules/video_zencoder/video_zencoder.module @@ -100,7 +100,8 @@ function _video_zencoder_postback_jobs() { // echo 'working failed'; $zc->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 { + } + else { echo 'zencoder postback is working'; } } -- cgit v1.2.3