Clean up MetadataLoader.ts
See original GitHub issuePigallery2 is using multiple exif, iptc parers (as I could not find one that can do all at once) to get all the metadata for a photo:
-
fs.statSync for silesize, creation date (if i do not find any better from exif) https://github.com/bpatrik/pigallery2/blob/36ecbcbd3d5d3e659ddf20add456982dcb960d3d/src/backend/model/threading/MetadataLoader.ts#L107
-
ts-exif-parser
for most of the exif data: https://github.com/bpatrik/pigallery2/blob/36ecbcbd3d5d3e659ddf20add456982dcb960d3d/src/backend/model/threading/MetadataLoader.ts#L114 -
image-size
to get the photo dimension if 2)ts-exif-parser
fails: https://github.com/bpatrik/pigallery2/blob/36ecbcbd3d5d3e659ddf20add456982dcb960d3d/src/backend/model/threading/MetadataLoader.ts#L169 (The image dimension is a must for this app to work properly ) -
ts-node-iptc
for GPS/location, keywords, caption related info: https://github.com/bpatrik/pigallery2/blob/36ecbcbd3d5d3e659ddf20add456982dcb960d3d/src/backend/model/threading/MetadataLoader.ts#L177 -
exifreader
for faces and now for orientation as this lib parses that properly https://github.com/bpatrik/pigallery2/blob/36ecbcbd3d5d3e659ddf20add456982dcb960d3d/src/backend/model/threading/MetadataLoader.ts#L206
This class needs a major refactor. Probably. exifreader
would be able to handle all cases now. Reducing to only one lib, photo indexing would be probably way faster (instead of 4-5 file open, 1 would do the trick)
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (6 by maintainers)
Top GitHub Comments
Thank you, @mattiasw for your library. I think that is the best candidate for pigallry2 to have “one exif reader to rule them all”.
So far I’m not planning to put effort in it on my side. I opened this bug if anyone feels the power to implement it 😃 We already have some unit tests in place for the Metadata loader , so a refactor should be relatively safe.
exifr now support sidecars: https://github.com/MikeKovarik/exifr/issues/62