Media: Store audio creation date in meta.

In [41746], `wp_get_media_creation_timestamp()` was introduced to read the created timestamp for videos from `getID3` in meta whenever possible. This information is useful separately from the dates on the file itself.

This adds the same support audio files by utilizing `wp_get_media_creation_timestamp()` in `wp_read_audio_metadata()`.

Props blob folio, desrosj.
Fixes #42017.
Built from https://develop.svn.wordpress.org/trunk@44528


git-svn-id: http://core.svn.wordpress.org/trunk@44359 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
desrosj 2019-01-10 01:32:50 +00:00
parent cf1e3b0c40
commit 13c66b1b18
2 changed files with 10 additions and 2 deletions

View File

@ -3340,7 +3340,7 @@ function wp_read_video_metadata( $file ) {
}
/**
* Retrieve metadata from a audio file's ID3 tags
* Retrieve metadata from an audio file's ID3 tags.
*
* @since 3.6.0
*
@ -3384,6 +3384,14 @@ function wp_read_audio_metadata( $file ) {
$metadata['length_formatted'] = $data['playtime_string'];
}
if ( empty( $metadata['created_timestamp'] ) ) {
$created_timestamp = wp_get_media_creation_timestamp( $data );
if ( false !== $created_timestamp ) {
$metadata['created_timestamp'] = $created_timestamp;
}
}
wp_add_id3_tag_data( $metadata, $data );
return $metadata;

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.1-alpha-44527';
$wp_version = '5.1-alpha-44528';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.