2
0
mirror of https://github.com/thumbsup/thumbsup synced 2024-11-05 12:01:04 +00:00

Fix #71: read both Quicktime CreationDate and CreateDate

This commit is contained in:
Romain 2017-08-13 21:28:00 +10:00
parent 0b27d37881
commit b92724472e
2 changed files with 10 additions and 2 deletions

View File

@ -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 {

View File

@ -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'