fix: restore Picasa support after regression bug

Fixes #204
pull/231/head
Romain 3 years ago
parent 0dd4fc7e4c
commit a5f97ef5c8

@ -25,7 +25,7 @@ class Metadata {
constructor (exiftool, picasa, opts) {
// standardise metadata
this.date = getDate(exiftool)
this.caption = caption(exiftool)
this.caption = caption(exiftool, picasa)
this.keywords = keywords(exiftool, picasa)
this.people = people(exiftool)
this.video = video(exiftool)

@ -5,6 +5,7 @@ Caches the results in <thumbsup.db> for faster re-runs
--------------------------------------------------------------------------------
*/
const path = require('path')
const hierarchy = require('../input/hierarchy.js')
const Index = require('../components/index/index')
const info = require('debug')('thumbsup:info')
@ -37,7 +38,8 @@ exports.run = function (opts, callback) {
// emitted for every file once indexing is finished
emitter.on('file', file => {
const picasa = picasaReader.file(file.metadata.SourceFile)
const filePath = path.join(opts.input, file.metadata.SourceFile)
const picasa = picasaReader.file(filePath)
const meta = new Metadata(file.metadata, picasa || {}, opts)
const model = new File(file.metadata, meta, opts)
// only include valid photos and videos (i.e. exiftool recognised the format)

@ -0,0 +1,25 @@
const should = require('should/as-function')
const IntegrationTest = require('./integration-test')
const fixtures = require('../fixtures')
describe('Integration: picasa', function () {
this.slow(5000)
this.timeout(5000)
beforeEach(IntegrationTest.before)
afterEach(IntegrationTest.after)
it('reads a picasa.ini file', function (done) {
const integration = new IntegrationTest({
'input/folder/IMG_0001.jpg': fixtures.fromDisk('photo.jpg'),
'input/folder/picasa.ini': '[IMG_0001.jpg]\ncaption=Beach'
})
const customOpts = []
integration.run(customOpts, () => {
integration.assertExist(['index.html', 'folder.html'])
const res = integration.parseYaml('folder.html')
should(res.files[0].caption).eql('Beach')
done()
})
})
})

@ -148,6 +148,13 @@ describe('Metadata', function () {
should(meta.caption).eql('some caption')
})
})
it('can be read from Picasa', function () {
const exiftool = fixtures.exiftool()
const picasa = { caption: 'some caption' }
const meta = new Metadata(exiftool, picasa)
should(meta.caption).eql('some caption')
})
})
describe('keywords', function () {

Loading…
Cancel
Save