function error_log_array($a_output, $i_tab_level = 0) { $s_tab = str_repeat(" ", $i_tab_level); foreach ($a_output as $k => $v) { if (is_object($v)) { $v = (array) $v; } if (is_array($v)) { error_log("{$s_tab}{$k}: array: ****"); error_log_array($v, $i_tab_level + 1); } else { error_log("{$s_tab}{$k}: {$v} ****"); } } }
private function send_video_for_encoding($post_id) { $s3info = get_post_meta($post_id, 'amazonS3_info', true); if (empty($s3info)) { return false; } update_post_meta($post_id, 'waz_encode_status', 'pending'); $encoding_job = null; try { $input = "s3://{$s3info['bucket']}/{$s3info['key']}"; $pathinfo = pathinfo($input); $key = trailingslashit(dirname($input)); //Easiest way to force a new bucket, this does tie this fork to MAJ though $key = preg_replace('#myartsjournal#', 'myartsjournal-encoded', $key); // New Encoding Job $job = $this->zen->jobs->create(array("input" => $input, "outputs" => array(array('label' => 'web', 'url' => $key . $pathinfo['filename'] . '.mp4', 'public' => true, 'device_profile' => 'mobile/advanced', 'notifications' => array(array("url" => apply_filters('waz_notification_url', get_home_url(get_current_blog_id(), '/waz_zencoder_notification/', 'https')))))))); update_post_meta($post_id, 'waz_encode_status', 'submitting'); update_post_meta($post_id, 'waz_encode_status', 'transcoding'); update_post_meta($post_id, 'waz_job_id', $job->id); update_post_meta($post_id, 'waz_outputs', (array) $job->outputs); if (is_multisite()) { update_site_option('waz_job_' . $job->id . '_blog_id', get_current_blog_id()); } } catch (Services_Zencoder_Exception $e) { error_log_array($e->getMessage()); error_log_array($e->getErrors()); update_post_meta($post_id, 'waz_encode_status', 'failed'); update_post_meta($post_id, 'waz_encode_error', $e->getErrors()); } return true; }