-
Notifications
You must be signed in to change notification settings - Fork 129
Support for importing the in-camera ratings from Fujifilm cameras #99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice script. I've added some comments perhaps you can improve the script even a little bit.
contrib/fujifilm_ratings.lua
Outdated
local function detect_rating(event, image) | ||
local RAF_filename = tostring(image) | ||
local JPEG_filename = string.gsub(RAF_filename, "%.RAF$", ".JPG") | ||
local command = "exiftool -Rating " .. JPEG_filename |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could add a check if exiftool is installed on the system like this:
if not checkIfBinExists("exiftool") then
return
end
contrib/fujifilm_ratings.lua
Outdated
--]] | ||
|
||
darktable = require "darktable" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check the version you have tested the script with, like this:
darktable.configuration.check_version(...,{4,0,0})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The version I have is 2.2.5, but I notice scripts in the repo claiming 4,0,0 and 5,0,0. Could you explain how the version numbering works? Should I use 2,2,5 or 4,0,0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The API Version is not the same then the darktable version. You can get the version with dt.configuration.api_version_string. Or simply use this script:
https://github.com/darktable-org/lua-scripts/blob/master/examples/api_version.lua
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or just run darktable --version
.
contrib/fujifilm_ratings.lua
Outdated
if string.len(jpeg_result) > 0 then | ||
jpeg_result = string.gsub(jpeg_result, "^Rating.*(%d)", "%1") | ||
image.rating = tonumber(jpeg_result) | ||
darktable.print_error("Using JPEG Rating: " .. tostring(jpeg_result)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could earn some bonus point if you would make the strings translatable. But that is not really needed for error messages.
Have a look at:
lua-scripts/examples/gettextExample.lua
or
lua-scripts/contrib/gimp.lua
contrib/fujifilm_ratings.lua
Outdated
|
||
darktable.register_event("post-import-image", detect_rating) | ||
|
||
darktable.print_error("fujifilm_ratings loaded.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think here is a print better then a print_error
Why do you want this as a Lua script? If you provide us with a sample file we can probably teach dt itself to understand that field. |
You're right, it would probably be better if darktable could handle it directly, like it does for Nikon NEF files. I guess I'm just used to having to fix my own issues with open source projects. Some things I've learned from trial and error:
I have put some samples here: https://drive.google.com/open?id=0B0p0PF3h5F9kTkF1X3gycmkweXM |
Bad news: At least my copy of exiv2 (version 0.25) doesn't understand that tag yet. Until that changed there isn't much we can do on darktable's side. So you will have to keep using your script. Once that changes we will of course add support for it. |
@supertobi I think I've addressed all of your feedback, thanks. |
Here we go, your script is in. |
No description provided.