Don't overwrite the `length` property unnecessarily when generating metadata for audio and video files.

Props jrf, wonderboymusic.
Fixes #29176.

Built from https://develop.svn.wordpress.org/trunk@29728


git-svn-id: http://core.svn.wordpress.org/trunk@29502 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-09-10 21:57:15 +00:00
parent 9a2750966c
commit fa0acbe3bb
1 changed files with 3 additions and 3 deletions

View File

@ -2860,7 +2860,7 @@ function wp_add_id3_tag_data( &$metadata, $data ) {
foreach ( array( 'id3v2', 'id3v1' ) as $version ) {
if ( ! empty( $data[$version]['comments'] ) ) {
foreach ( $data[$version]['comments'] as $key => $list ) {
if ( ! empty( $list ) ) {
if ( 'length' !== $key && ! empty( $list ) ) {
$metadata[$key] = reset( $list );
// Fix bug in byte stream analysis.
if ( 'terms_of_use' === $key && 0 === strpos( $metadata[$key], 'yright notice.' ) )
@ -2922,7 +2922,7 @@ function wp_read_video_metadata( $file ) {
if ( ! empty( $data['mime_type'] ) )
$metadata['mime_type'] = $data['mime_type'];
if ( ! empty( $data['playtime_seconds'] ) )
$metadata['length'] = (int) ceil( $data['playtime_seconds'] );
$metadata['length'] = (int) round( $data['playtime_seconds'] );
if ( ! empty( $data['playtime_string'] ) )
$metadata['length_formatted'] = $data['playtime_string'];
if ( ! empty( $data['video']['resolution_x'] ) )
@ -2978,7 +2978,7 @@ function wp_read_audio_metadata( $file ) {
if ( ! empty( $data['mime_type'] ) )
$metadata['mime_type'] = $data['mime_type'];
if ( ! empty( $data['playtime_seconds'] ) )
$metadata['length'] = (int) ceil( $data['playtime_seconds'] );
$metadata['length'] = (int) round( $data['playtime_seconds'] );
if ( ! empty( $data['playtime_string'] ) )
$metadata['length_formatted'] = $data['playtime_string'];