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

Props jrf, wonderboymusic.
Fixes #29176.


git-svn-id: https://develop.svn.wordpress.org/trunk@29728 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2014-09-10 21:56:24 +00:00
parent c339c62e38
commit 698f77735b
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'];