Media Grid, for audio files: show Bitrate in the Edit Attachments modal a la the Edit Post screen.
See #28839. Built from https://develop.svn.wordpress.org/trunk@29106 git-svn-id: http://core.svn.wordpress.org/trunk@28892 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ba688f4ff9
commit
e3c39d02cf
|
@ -312,6 +312,15 @@ function wp_print_media_templates() {
|
|||
<div class="file-length"><strong><?php _e( 'Length:' ); ?></strong> {{ data.fileLength }}</div>
|
||||
<# } #>
|
||||
|
||||
<# if ( 'audio' === data.type && data.meta.bitrate ) { #>
|
||||
<div class="bitrate">
|
||||
<strong><?php _e( 'Bitrate:' ); ?></strong> {{ Math.round( data.meta.bitrate / 1000 ) }}kb/s
|
||||
<# if ( data.meta.bitrate_mode ) { #>
|
||||
{{ ' ' + data.meta.bitrate_mode.toUpperCase() }}
|
||||
<# } #>
|
||||
</div>
|
||||
<# } #>
|
||||
|
||||
<# if ( ! data.uploading && data.can.remove ) { #>
|
||||
<?php if ( MEDIA_TRASH ): ?>
|
||||
<a class="trash-attachment" href="#"><?php _e( 'Trash' ); ?></a>
|
||||
|
|
|
@ -1463,6 +1463,9 @@ function wp_get_attachment_id3_keys( $attachment, $context = 'display' ) {
|
|||
$fields['genre'] = __( 'Genre' );
|
||||
$fields['year'] = __( 'Year' );
|
||||
$fields['length_formatted'] = _x( 'Length', 'video or audio' );
|
||||
} elseif ( 'js' === $context ) {
|
||||
$fields['bitrate'] = __( 'Bitrate' );
|
||||
$fields['bitrate_mode'] = __( 'Bitrate Mode' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2716,7 +2719,7 @@ function wp_prepare_attachment_for_js( $attachment ) {
|
|||
$response['fileLength'] = $meta['length_formatted'];
|
||||
|
||||
$response['meta'] = array();
|
||||
foreach ( wp_get_attachment_id3_keys( $attachment ) as $key => $label ) {
|
||||
foreach ( wp_get_attachment_id3_keys( $attachment, 'js' ) as $key => $label ) {
|
||||
if ( ! empty( $meta[ $key ] ) ) {
|
||||
$response['meta'][ $key ] = $meta[ $key ];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue