Fix #71: read both Quicktime CreationDate and CreateDate

pull/77/head
Romain 7 years ago
parent 0b27d37881
commit b92724472e

@ -42,7 +42,8 @@ class Metadata {
function getDate (exif) {
const date = tagValue(exif, 'EXIF', 'DateTimeOriginal') ||
tagValue(exif, 'H264', 'DateTimeOriginal') ||
tagValue(exif, 'QuickTime', 'CreationDate')
tagValue(exif, 'QuickTime', 'CreationDate') ||
tagValue(exif, 'QuickTime', 'CreateDate')
if (date) {
return moment(date, EXIF_DATE_FORMAT).valueOf()
} else {

@ -18,13 +18,20 @@ describe('Metadata', function () {
should(meta.date).eql(fixtures.date('2016-10-28 17:34:58').getTime())
})
it('reads the QuickTime date if present', function () {
it('reads the QuickTime CreationDate if present', function () {
const exiftool = fixtures.exiftool()
exiftool.QuickTime.CreationDate = '2016:10:28 17:34:58' // EXIF date format
const meta = new Metadata(exiftool)
should(meta.date).eql(fixtures.date('2016-10-28 17:34:58').getTime())
})
it('reads the QuickTime CreateDate if present', function () {
const exiftool = fixtures.exiftool()
exiftool.QuickTime.CreateDate = '2016:10:28 17:34:58' // EXIF date format
const meta = new Metadata(exiftool)
should(meta.date).eql(fixtures.date('2016-10-28 17:34:58').getTime())
})
it('infers the date from the filename (Android format)', function () {
const exiftool = fixtures.exiftool()
exiftool.SourceFile = 'folder/VID_20170220_114006.mp4'

Loading…
Cancel
Save