-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/add transcoded url meta #295
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code analysis identified issues
action-phpcs-code-review has identified potential problems in this pull request during automated scanning. We recommend reviewing the issues noted and that they are resolved.
phpcs scanning turned up:
🚫 29 errors
skipped-files
Maximum number of lines exceeded (15000):
- assets/build/blocks/rt-player/index.js
Note that the above file(s) were not analyzed due to their length.
Powered by rtCamp's GitHub Actions Library
Posting will continue in further review(s)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previous scan continued.
admin/rt-transcoder-handler.php
Outdated
// if ( $usage_info[ $this->api_key ]->remaining < 524288000 && ! get_site_option( 'rt-transcoding-usage-limit-mail' ) ) { | ||
// $this->nearing_usage_limit( $usage_info ); | ||
// } elseif ( $usage_info[ $this->api_key ]->remaining > 524288000 && get_site_option( 'rt-transcoding-usage-limit-mail' ) ) { | ||
// update_site_option( 'rt-transcoding-usage-limit-mail', 0 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 Error: Expected 1 space before comment text but found 2; use block comment if you need indentation (Squiz.Commenting.InlineComment.SpacingBefore).
admin/rt-transcoder-handler.php
Outdated
// update_site_option( 'rt-transcoding-usage-limit-mail', 0 ); | ||
// } | ||
// if ( strtotime( $usage_info[ $this->api_key ]->plan->expires ) > time() ) { | ||
// add_filter( 'wp_generate_attachment_metadata', array( $this, 'wp_media_transcoding' ), 21, 2 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 Error: Spaces must be used for mid-line alignment; tabs are not allowed (Universal.WhiteSpace.DisallowInlineTabs.NonIndentTabsUsed).
admin/rt-transcoder-handler.php
Outdated
// update_site_option( 'rt-transcoding-usage-limit-mail', 0 ); | ||
// } | ||
// if ( strtotime( $usage_info[ $this->api_key ]->plan->expires ) > time() ) { | ||
// add_filter( 'wp_generate_attachment_metadata', array( $this, 'wp_media_transcoding' ), 21, 2 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 Error: Expected 1 space before comment text but found 2; use block comment if you need indentation (Squiz.Commenting.InlineComment.SpacingBefore).
// } | ||
// if ( strtotime( $usage_info[ $this->api_key ]->plan->expires ) > time() ) { | ||
// add_filter( 'wp_generate_attachment_metadata', array( $this, 'wp_media_transcoding' ), 21, 2 ); | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 Error: Inline comments must end in full-stops, exclamation marks, or question marks (Squiz.Commenting.InlineComment.InvalidEndChar).
admin/rt-transcoder-handler.php
Outdated
@@ -264,27 +268,27 @@ | |||
'api_token' => $this->api_key, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
admin/rt-transcoder-handler.php
Outdated
@@ -264,27 +268,27 @@ | |||
'api_token' => $this->api_key, | |||
'job_type' => $job_type, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
admin/rt-transcoder-handler.php
Outdated
@@ -264,27 +268,27 @@ | |||
'api_token' => $this->api_key, | |||
'job_type' => $job_type, | |||
'job_for' => $job_for, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
admin/rt-transcoder-handler.php
Outdated
@@ -264,27 +268,27 @@ | |||
'api_token' => $this->api_key, | |||
'job_type' => $job_type, | |||
'job_for' => $job_for, | |||
'file_url' => rawurlencode( $url ), | |||
'file_origin' => rawurlencode( $url ), | |||
'callback_url' => rawurlencode( trailingslashit( home_url() ) . 'index.php' ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
admin/rt-transcoder-handler.php
Outdated
@@ -264,27 +268,27 @@ | |||
'api_token' => $this->api_key, | |||
'job_type' => $job_type, | |||
'job_for' => $job_for, | |||
'file_url' => rawurlencode( $url ), | |||
'file_origin' => rawurlencode( $url ), | |||
'callback_url' => rawurlencode( trailingslashit( home_url() ) . 'index.php' ), | |||
'force' => 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previous scan continued.
admin/rt-transcoder-handler.php
Outdated
@@ -264,27 +268,27 @@ public function wp_media_transcoding( $wp_metadata, $attachment_id, $autoformat | |||
'api_token' => $this->api_key, | |||
'job_type' => $job_type, | |||
'job_for' => $job_for, | |||
'file_url' => rawurlencode( $url ), | |||
'file_origin' => rawurlencode( $url ), | |||
'callback_url' => rawurlencode( trailingslashit( home_url() ) . 'index.php' ), | |||
'force' => 0, | |||
'formats' => ( true === $autoformat ) ? ( ( 'video' === $type_array[0] ) ? 'mp4' : 'mp3' ) : $autoformat, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
admin/rt-transcoder-handler.php
Outdated
'callback_url' => rawurlencode( trailingslashit( home_url() ) . 'index.php' ), | ||
'force' => 0, | ||
'formats' => ( true === $autoformat ) ? ( ( 'video' === $type_array[0] ) ? 'mp4' : 'mp3' ) : $autoformat, | ||
'thumb_count' => $options_video_thumb, | ||
'thumbnail_count' => $options_video_thumb, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
admin/rt-transcoder-handler.php
Outdated
if ( ! is_wp_error( $upload_page ) && | ||
( | ||
isset( $upload_page['response']['code'] ) && | ||
200 === intval( $upload_page['response']['code'] ) | ||
) | ||
) { | ||
$upload_info = json_decode( $upload_page['body'] ); | ||
if ( isset( $upload_info->status ) && $upload_info->status && isset( $upload_info->job_id ) && $upload_info->job_id ) { | ||
$job_id = $upload_info->job_id; | ||
error_log(json_encode($upload_info)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 Error: error_log() found. Debug code should not normally be used in production (WordPress.PHP.DevelopmentFunctions.error_log_error_log).
admin/rt-transcoder-handler.php
Outdated
if ( ! is_wp_error( $upload_page ) && | ||
( | ||
isset( $upload_page['response']['code'] ) && | ||
200 === intval( $upload_page['response']['code'] ) | ||
) | ||
) { | ||
$upload_info = json_decode( $upload_page['body'] ); | ||
if ( isset( $upload_info->status ) && $upload_info->status && isset( $upload_info->job_id ) && $upload_info->job_id ) { | ||
$job_id = $upload_info->job_id; | ||
error_log(json_encode($upload_info)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 Error: Expected 1 spaces after opening parenthesis; 0 found (PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket).
admin/rt-transcoder-handler.php
Outdated
if ( ! is_wp_error( $upload_page ) && | ||
( | ||
isset( $upload_page['response']['code'] ) && | ||
200 === intval( $upload_page['response']['code'] ) | ||
) | ||
) { | ||
$upload_info = json_decode( $upload_page['body'] ); | ||
if ( isset( $upload_info->status ) && $upload_info->status && isset( $upload_info->job_id ) && $upload_info->job_id ) { | ||
$job_id = $upload_info->job_id; | ||
error_log(json_encode($upload_info)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
admin/rt-transcoder-handler.php
Outdated
if ( ! is_wp_error( $upload_page ) && | ||
( | ||
isset( $upload_page['response']['code'] ) && | ||
200 === intval( $upload_page['response']['code'] ) | ||
) | ||
) { | ||
$upload_info = json_decode( $upload_page['body'] ); | ||
if ( isset( $upload_info->status ) && $upload_info->status && isset( $upload_info->job_id ) && $upload_info->job_id ) { | ||
$job_id = $upload_info->job_id; | ||
error_log(json_encode($upload_info)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 Error: Expected 1 spaces before closing parenthesis; 0 found (PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket).
admin/rt-transcoder-handler.php
Outdated
@@ -1151,7 +1156,12 @@ public function handle_callback() { | |||
} | |||
|
|||
if ( ! empty( $post_array['files'] ) ) { | |||
$this->add_transcoded_files( $post_array['files'], $attachment_id, $job_for ); | |||
if ( ! empty($post_array['files']['mpd']) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 Error: Expected 1 spaces after opening parenthesis; 0 found (PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket).
admin/rt-transcoder-handler.php
Outdated
@@ -1151,7 +1156,12 @@ public function handle_callback() { | |||
} | |||
|
|||
if ( ! empty( $post_array['files'] ) ) { | |||
$this->add_transcoded_files( $post_array['files'], $attachment_id, $job_for ); | |||
if ( ! empty($post_array['files']['mpd']) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 Error: Expected 1 spaces before closing parenthesis; 0 found (PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket).
admin/rt-transcoder-handler.php
Outdated
@@ -1151,7 +1156,12 @@ public function handle_callback() { | |||
} | |||
|
|||
if ( ! empty( $post_array['files'] ) ) { | |||
$this->add_transcoded_files( $post_array['files'], $attachment_id, $job_for ); | |||
if ( ! empty($post_array['files']['mpd']) ) { | |||
update_post_meta( $attachment_id, '_rt_transcoded_url', $post_array['download_url'] ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 Error: Expected 1 spaces before closing parenthesis; 2 found (PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket).
admin/rt-transcoder-handler.php
Outdated
$this->add_transcoded_files( $post_array['files'], $attachment_id, $job_for ); | ||
if ( ! empty($post_array['files']['mpd']) ) { | ||
update_post_meta( $attachment_id, '_rt_transcoded_url', $post_array['download_url'] ); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 Error: Expected 1 space after closing brace; newline found (Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previous scan continued.
admin/rt-transcoder-handler.php
Outdated
@@ -1633,6 +1643,9 @@ private function filter_transcoder_response() { | |||
} elseif ( ! empty( $post_var['files']['mp3'][0] ) ) { | |||
$post_array['files']['mp3'][] = filter_var( $post_var['files']['mp3'][0], FILTER_SANITIZE_URL ); | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 Error: Expected 1 space after closing brace; newline found (Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace).
@@ -0,0 +1 @@ | |||
<?php return array('dependencies' => array(), 'version' => '9a42bf9ab6cdcc318598'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 Error: Missing file doc comment (Squiz.Commenting.FileComment.Missing).
@@ -0,0 +1 @@ | |||
<?php return array('dependencies' => array(), 'version' => '9a42bf9ab6cdcc318598'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 Error: Expected 1 space after the array opener in a single line array. Found: no spaces (NormalizedArrays.Arrays.ArrayBraceSpacing.SpaceAfterArrayOpenerSingleLine).
@@ -0,0 +1 @@ | |||
<?php return array('dependencies' => array(), 'version' => '9a42bf9ab6cdcc318598'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 Error: When a multi-item array uses associative keys, each value should start on a new line (WordPress.Arrays.ArrayDeclarationSpacing.AssociativeArrayFound).
@@ -0,0 +1 @@ | |||
<?php return array('dependencies' => array(), 'version' => '9a42bf9ab6cdcc318598'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 Error: Expected 1 space before the array closer in a single line array. Found: no spaces (NormalizedArrays.Arrays.ArrayBraceSpacing.SpaceBeforeArrayCloserSingleLine).
@@ -0,0 +1 @@ | |||
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => 'e4cc6333f7212ea97e3b'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 Error: Missing file doc comment (Squiz.Commenting.FileComment.Missing).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previous scan continued.
Types of changes
What types of changes does your code introduced to project?
Put an
x
in the boxes that applyDetails
_rt_transcoded_url
meta field to the attachment to save the transcoded URL.URL
form field in the media modal.Adaptive Bitrate Streaming
in the transcoder settings page.Checklist
Put an
x
in the boxes that apply.Closing issues