WordPress.org

Make WordPress Core

Opened 9 months ago

Last modified 3 months ago

#42017 assigned enhancement

Parse the creation date out of uploaded audio files

Reported by: desrosj Owned by: desrosj
Milestone: 5.0 Priority: normal
Severity: normal Version:
Component: Media Keywords: has-patch has-unit-tests needs-testing
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 (4)

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

Download all attachments as: .zip

Change History (22)

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


9 months ago

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


9 months ago

#3 @blobfolio
9 months 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.


9 months ago

@desrosj
9 months ago

Parse WMA files fir creation date.

@desrosj
9 months ago

Test WMA file.

#5 @desrosj
9 months 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.


9 months ago

#7 @desrosj
9 months ago

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

#8 @desrosj
8 months 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.


8 months ago

#10 @joemcgill
8 months ago

  • Milestone changed from Awaiting Review to 4.9.1

#11 @johnbillion
7 months ago

  • Milestone changed from 4.9.1 to 5.0

@desrosj
6 months ago

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

#12 @desrosj
6 months 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.


6 months ago

@desrosj
6 months ago

Remove AAC fix (see #42919)

#14 @desrosj
6 months 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.


5 months ago

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


3 months ago

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


3 months ago

#18 @desrosj
3 months ago

  • Type changed from defect (bug) to enhancement
Note: See TracTickets for help on using tickets.