1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2025-12-05 23:18:43 +02:00

consolidate exif parsing libraries - rework of timestamps (#4)

* exifr is used for most tags now

* New timestamp handling, removed exif-parser, date supported for png

* Removed offset from testhelper. It's optional

* explanations

* Feature/timestamps (#3)

* preparing for further timestamp test

* Added more test and fixed offset calculation bug

* Revered old dimension test, added new timestamp tests, some bug fixes

* Renamed png-test because faces overrule keywords
This commit is contained in:
grasdk
2024-02-11 15:55:26 +01:00
committed by GitHub
parent 8c3bd650ad
commit b2be0a9763
26 changed files with 408 additions and 176 deletions

View File

@@ -24,11 +24,16 @@ describe('MetadataLoader', () => {
it('should load png', async () => {
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/test_png.png'));
delete data.creationDate; // creation time for png not supported
const expected = require(path.join(__dirname, '/../../../assets/test_png.json'));
expect(Utils.clone(data)).to.be.deep.equal(expected);
});
it('should load png with faces and dates', async () => {
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/png_with_faces_and_dates.png'));
const expected = require(path.join(__dirname, '/../../../assets/png_with_faces_and_dates.json'));
expect(Utils.clone(data)).to.be.deep.equal(expected);
});
it('should load jpg', async () => {
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/test image öüóőúéáű-.,.jpg'));
const expected = require(path.join(__dirname, '/../../../assets/test image öüóőúéáű-.,.json'));
@@ -69,6 +74,31 @@ describe('MetadataLoader', () => {
expect(Utils.clone(data)).to.be.deep.equal(expected);
});
it('should load jpg with timestamps, timezone AEST (UTC+10) and gps (UTC)', async () => {
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/timestamps/sydney_opera_house.jpg'));
const expected = require(path.join(__dirname, '/../../../assets/timestamps/sydney_opera_house.json'));
expect(Utils.clone(data)).to.be.deep.equal(expected);
});
it('should load jpg with timestamps and gps (UTC) and calculate offset +10', async () => {
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/timestamps/sydney_opera_house_no_tsoffset_but_gps_utc.jpg'));
const expected = require(path.join(__dirname, '/../../../assets/timestamps/sydney_opera_house_no_tsoffset_but_gps_utc.json'));
expect(Utils.clone(data)).to.be.deep.equal(expected);
});
it('should load jpg with timestamps, timezone BST (UTC+1) and gps (UTC)', async () => {
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/timestamps/big_ben.jpg'));
const expected = require(path.join(__dirname, '/../../../assets/timestamps/big_ben.json'));
expect(Utils.clone(data)).to.be.deep.equal(expected);
});
it('should load jpg with timestamps and gps (UTC) and calculate offset +1', async () => {
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/timestamps/big_ben_no_tsoffset_but_gps_utc.jpg'));
const expected = require(path.join(__dirname, '/../../../assets/timestamps/big_ben_no_tsoffset_but_gps_utc.json'));
expect(Utils.clone(data)).to.be.deep.equal(expected);
});
it('should load jpg with timestamps but no offset and no GPS to calculate it from', async () => {
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/timestamps/big_ben_only_time.jpg'));
const expected = require(path.join(__dirname, '/../../../assets/timestamps/big_ben_only_time.json'));
expect(Utils.clone(data)).to.be.deep.equal(expected);
});
describe('should load jpg with proper height and orientation', () => {
it('jpg 1', async () => {
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/orientation/broken_orientation_exif.jpg'));