mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-10-07 03:11:57 -04:00
fix(search): take the photo iso from exif:IsoSpeedRatings
Base ISO is a Canon maker note tag holding Canon's raw encoded value, not the iso of the shot: other cameras got no iso, Canon photos a wrong one (256 for an ISO 800 shot). exif:IsoSpeedRatings is there on tika 3 and tika 4.
This commit is contained in:
1 parent
4006344505
commit
63c1f15cee
2 files changed
+12
-2
No files matched your search
@@ -40,7 +40,7 @@ func (t Tika) getPhoto(meta map[string][]string) *libregraph.Photo {
|
||||
}
|
||||
}
|
||||
|
||||
if v, err := getFirstValue(meta, "Base ISO"); err == nil {
|
||||
if v, err := getFirstValue(meta, "exif:IsoSpeedRatings"); err == nil {
|
||||
if i, err := strconv.ParseInt(v, 0, 32); err == nil {
|
||||
initPhoto()
|
||||
photo.SetIso(int32(i))
|
||||
|
||||
@@ -16,7 +16,7 @@ var _ = Describe("getPhoto", func() {
|
||||
"exif:ExposureTime": {"0.001"},
|
||||
"exif:FNumber": {"1.8"},
|
||||
"exif:FocalLength": {"50"},
|
||||
"Base ISO": {"100"},
|
||||
"exif:IsoSpeedRatings": {"100"},
|
||||
"tiff:Orientation": {"1"},
|
||||
"exif:DateTimeOriginal": {"2018-01-01T12:34:56"},
|
||||
})
|
||||
@@ -32,6 +32,16 @@ var _ = Describe("getPhoto", func() {
|
||||
Expect(photo.TakenDateTime).To(Equal(libregraph.PtrTime(time.Date(2018, 1, 1, 12, 34, 56, 0, time.UTC))))
|
||||
})
|
||||
|
||||
It("takes the iso of the shot, not the canon maker note base iso", func() {
|
||||
photo := Tika{}.getPhoto(map[string][]string{
|
||||
"exif:IsoSpeedRatings": {"800"},
|
||||
"Base ISO": {"256"},
|
||||
"img:Base ISO": {"256"},
|
||||
})
|
||||
Expect(photo).ToNot(BeNil())
|
||||
Expect(photo.Iso).To(Equal(libregraph.PtrInt32(800)))
|
||||
})
|
||||
|
||||
It("returns nil when no photo metadata is present", func() {
|
||||
Expect(Tika{}.getPhoto(map[string][]string{})).To(BeNil())
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user