WordPress.org

Make WordPress Core

Opened 17 months ago

Closed 5 weeks ago

Last modified 5 weeks ago

#42017 closed enhancement (fixed)

Parse the creation date out of uploaded audio files

Reported by: desrosj Owned by: 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 17 months ago.
Parse WMA files fir creation date.
test.wma (26.8 KB) - added by desrosj 17 months ago.
Test WMA file.
42017.2.patch (2.3 KB) - added by desrosj 14 months ago.
Patch refresh and adding fix for AAC file uploads being blocked.
42017.3.patch (1.8 KB) - added by desrosj 14 months ago.
Remove AAC fix (see #42919)
42017.diff (1.4 KB) - added by desrosj 5 weeks ago.

Download all attachments as: .zip

Change History (32)

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


17 months ago

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


17 months ago

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


17 months ago

@desrosj
17 months ago

Parse WMA files fir creation date.

@desrosj
17 months ago

Test WMA file.

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


17 months ago

#7 @desrosj
17 months ago

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

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


16 months ago

#10 @joemcgill
16 months ago

  • Milestone changed from Awaiting Review to 4.9.1

#11 @johnbillion
15 months ago

  • Milestone changed from 4.9.1 to 5.0

@desrosj
14 months ago

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

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


14 months ago

@desrosj
14 months ago

Remove AAC fix (see #42919)

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


13 months ago

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


11 months ago

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


11 months ago

#18 @desrosj
11 months ago

  • Type changed from defect (bug) to enhancement

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


7 months ago

#20 @desrosj
4 months 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 weeks ago

@desrosj
5 weeks ago

#22 @desrosj
5 weeks 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.


5 weeks ago

#24 @mikeschroder
5 weeks ago

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

#25 @desrosj
5 weeks 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
5 weeks ago

  • Keywords needs-testing removed

#27 @desrosj
5 weeks ago

In 44532:

PHPCS: Fix formatting issues.

Fixes formatting issues introduced in [44528].

See #42017.

Note: See TracTickets for help on using tickets.