You've already forked pigallery2
mirror of
https://github.com/bpatrik/pigallery2.git
synced 2026-05-16 09:21:12 +02:00
Merge pull request #1138 from grasdk/bugfix/handle-nonstandard-offsets
Fix for handling non-standard offset formats without zero padding
This commit is contained in:
@@ -389,7 +389,7 @@ export class MetadataLoader {
|
||||
}
|
||||
}
|
||||
metadata.creationDate = Utils.timestampToMS(ts, offset) || metadata.creationDate;
|
||||
metadata.creationDateOffset = offset || metadata.creationDateOffset;
|
||||
metadata.creationDateOffset = normalizeOffset(offset || metadata.creationDateOffset);
|
||||
//---- End of mapTimestampAndOffset logic ----
|
||||
|
||||
//---- Helper functions for mapTimestampAndOffset ----
|
||||
@@ -426,6 +426,11 @@ export class MetadataLoader {
|
||||
return [ts, offset];
|
||||
}
|
||||
|
||||
//Pads hours and minutes with leading zeroes if needed
|
||||
function normalizeOffset(o: string): string {
|
||||
return o.replace(/^([+-]?)(\d):/, "$10$2:");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 5.8 KiB |
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"cameraData": {
|
||||
"ISO": 46,
|
||||
"exposure": 0.000943,
|
||||
"fStop": 1.89,
|
||||
"focalLength": 5.43,
|
||||
"make": "Google",
|
||||
"model": "Pixel 7a"
|
||||
},
|
||||
"creationDate": 1756849708000,
|
||||
"creationDateOffset": "-05:00",
|
||||
"fileSize": 5951,
|
||||
"keywords": [
|
||||
"Illinois",
|
||||
"Chicago",
|
||||
"United States",
|
||||
"America"
|
||||
],
|
||||
"positionData": {
|
||||
"GPSData": {
|
||||
"latitude": 41.873138,
|
||||
"longitude": -87.626329
|
||||
}
|
||||
},
|
||||
"size": {
|
||||
"height": 7,
|
||||
"width": 5
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 61 KiB |
@@ -363,7 +363,11 @@ describe('MetadataLoader', () => {
|
||||
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
||||
});
|
||||
|
||||
|
||||
it('test offset of pixel 7a photo', async () => {
|
||||
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/pixel7a-offset.jpg'));
|
||||
const expected = require(path.join(__dirname, '/../../../assets/pixel7a-offset.json'));
|
||||
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
||||
});
|
||||
|
||||
describe('should load metadata from files with times and coordinates in different parts of the world', () => {
|
||||
const root = path.join(__dirname, '/../../../assets/4MinsAroundTheWorld');
|
||||
|
||||
Reference in New Issue
Block a user