Make WordPress Core

Opened 7 years ago

Closed 6 years ago

Last modified 6 years ago

#42017 closed enhancement (fixed)

Parse the creation date out of uploaded audio files

Reported by: desrosj's profile desrosj Owned by: desrosj's profile desrosj
Milestone: 5.1 Priority: normal
Severity: normal Version:
Component: Media Keywords: has-patch has-unit-tests
Focuses: Cc:

Description

This is a companion ticket to #35218 which adds parsing for the creation date out of uploaded video files, and will introduce wp_get_media_creation_timestamp().

The same should be done for audio files using the same function.

Attachments (5)

42017.patch (1.8 KB) - added by desrosj 7 years ago.
Parse WMA files fir creation date.
test.wma (26.8 KB) - added by desrosj 7 years ago.
Test WMA file.
42017.2.patch (2.3 KB) - added by desrosj 7 years ago.
Patch refresh and adding fix for AAC file uploads being blocked.
42017.3.patch (1.8 KB) - added by desrosj 7 years ago.
Remove AAC fix (see #42919)
42017.diff (1.4 KB) - added by desrosj 6 years ago.

Download all attachments as: .zip

Change History (32)

This ticket was mentioned in Slack in #core-media by desrosj. View the logs.


7 years ago

This ticket was mentioned in Slack in #core-media by desrosj. View the logs.


7 years ago

#3 @blobfolio
7 years ago

I uploaded a handful of test files to a site and debugged the raw ID3 data. Here is what that turned up:

MP3, FLAC:

None of these had anything like a file creation timestamp, only meta related to the recording like "year".

MPC:

ID3 error: Format not supported, module "module.audio.mpc.php" was removed.

MP4:

This is stored exactly like MP4 video: $metadata['quicktime']['moov']['subatoms']['0']['creation_time_unix']

WMA:

Works just like video "asf": $metadata['asf']['file_properties_object']['creation_date_unix']

This ticket was mentioned in Slack in #core-media by joemcgill. View the logs.


7 years ago

@desrosj
7 years ago

Parse WMA files fir creation date.

@desrosj
7 years ago

Test WMA file.

#5 @desrosj
7 years ago

  • Keywords has-patch has-unit-tests added; needs-patch removed

In 42017.patch I added the same approach used in wp_read_video_metadata() to wp_read_audio_metadata() (see r41746). Also attached is a test file that should go in the tests/phpunit/data/uploads/ directory.

I talked this over with @blobfolio. The only other file type that may be worth checking is an AAC (Apple audio). I will run some tests on that format when I get a chance.

This ticket was mentioned in Slack in #core-media by desrosj. View the logs.


7 years ago

#7 @desrosj
7 years ago

  • Owner set to desrosj
  • Status changed from new to assigned

#8 @desrosj
7 years ago

Looks like the wp-includes/ID3/module.audio-video-asf.php file has an anonymous function in it, so the tests do not pass on PHP 5.2 (https://travis-ci.org/desrosj/wordpress-develop/builds/284383012).

This ticket was mentioned in Slack in #core-media by desrosj. View the logs.


7 years ago

#10 @joemcgill
7 years ago

  • Milestone changed from Awaiting Review to 4.9.1

#11 @johnbillion
7 years ago

  • Milestone changed from 4.9.1 to 5.0

@desrosj
7 years ago

Patch refresh and adding fix for AAC file uploads being blocked.

#12 @desrosj
7 years ago

  • Keywords needs-testing added

Based on my testing, AAC files store the created date in the same location as mp4 and quicktime files.

I did discover that you can't currently upload AAC files, though. This was due to a missing mime type in wp_get_mime_types(). I added a fix for that in 42017.2.patch. I can create a separate ticket for that issue if necessary.

This ticket was mentioned in Slack in #core-media by desrosj. View the logs.


7 years ago

@desrosj
7 years ago

Remove AAC fix (see #42919)

#14 @desrosj
7 years ago

Per the discussion in the most recent media chat, I have separated the AAC file fix in wp_get_mime_types() into a separate patch (#42919). 42017.3.patch is a refreshed patch.

This ticket was mentioned in Slack in #core-media by mike. View the logs.


7 years ago

This ticket was mentioned in Slack in #core-media by desrosj. View the logs.


7 years ago

This ticket was mentioned in Slack in #core-media by desrosj. View the logs.


7 years ago

#18 @desrosj
7 years ago

  • Type changed from defect (bug) to enhancement

This ticket was mentioned in Slack in #core-media by desrosj. View the logs.


6 years ago

#20 @desrosj
6 years ago

  • Milestone changed from 5.0 to 5.1

The ticket still applies cleanly and works. Punting to 5.1, though, as this falls outside of the 5.0 focuses.

This ticket was mentioned in Slack in #core-media by joemcgill. View the logs.


6 years ago

@desrosj
6 years ago

#22 @desrosj
6 years ago

42017.diff is a slimmed down approach that does not add the WMA location for created timestamp parsing.

This will add support for created_timestamp to MP4 and AAC audio files.

This ticket was mentioned in Slack in #core-media by desrosj. View the logs.


6 years ago

#24 @kirasong
6 years ago

42017.diff looks good, and tests pass for me locally.

#25 @desrosj
6 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 44528:

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.

#26 @desrosj
6 years ago

  • Keywords needs-testing removed

#27 @desrosj
6 years ago

In 44532:

PHPCS: Fix formatting issues.

Fixes formatting issues introduced in [44528].

See #42017.

Note: See TracTickets for help on using tickets.