Simplify util_clip_region()
[geeqie.git] / plugins / lens / lensID
1 -- Retrieve the lens ID data
2 -- Called from the pre-formatted tag lua.lensID
3 -- Requires lua and extftool
4 -- Runs rather slow
5
6 n = 0
7 m = 0
8 lensID = ""
9 lensIDstring = ""
10
11 path = Image:get_path()
12
13 lensIDfile = io.popen("exiftool -Composite:LensID \"" .. path .. "\" 2>/dev/null ")
14 lensID = lensIDfile:read("*a")
15
16 if lensID ~= ""
17 then
18         n = string.find(lensID, ":")
19         if n > 2
20         then
21                 n = n + 2
22                 lensIDstring = string.sub(lensID, n)
23                 m = string.find(lensIDstring, "Unknown")
24                 if m ~= nil
25                 then
26                         lensIDstring = ""
27                 else
28                         lensIDstring = string.gsub(lensIDstring, "\n", "")
29                 end
30         end
31 end
32
33 lensIDfile:close()
34 return (lensIDstring)