Merge pull request #653 from deekayhd/no_exif_date_corr
fix wrong month in EXIF.MONTH.LONG and EXIF_MONTH.SHORT when no exif date available in image Thanks
This commit is contained in:
@@ -773,33 +773,29 @@ function dtutils_string.build_substitute_list(image, sequence, variable_string,
|
|||||||
|
|
||||||
local labels = get_colorlabels(image)
|
local labels = get_colorlabels(image)
|
||||||
|
|
||||||
local datetime_taken = ""
|
local emon_long, emon_short
|
||||||
|
local eyear, emon, eday, ehour, emin, esec, emsec
|
||||||
local use_millisecs = false
|
local use_millisecs = false
|
||||||
if dt.preferences.read("darktable", "lighttable/ui/milliseconds", "bool") and is_api_9_1 then
|
if dt.preferences.read("darktable", "lighttable/ui/milliseconds", "bool") and is_api_9_1 then
|
||||||
use_millisecs = true
|
use_millisecs = true
|
||||||
end
|
end
|
||||||
|
|
||||||
if image.exif_datetime_taken and image.exif_datetime_taken ~= "" then
|
if image.exif_datetime_taken and image.exif_datetime_taken ~= "" then
|
||||||
datetime_taken = image.exif_datetime_taken
|
emon_long = os.date("%B", exiftime2systime(image.exif_datetime_taken))
|
||||||
else
|
emon_short = os.date("%b", exiftime2systime(image.exif_datetime_taken))
|
||||||
if use_millisecs then
|
if use_millisecs then
|
||||||
datetime_taken = "0000:00:00 00:00:00.0"
|
eyear, emon, eday, ehour, emin, esec, emsec =
|
||||||
|
string.match(datetime_taken, "(%d+):(%d+):(%d+) (%d+):(%d+):(%d+)%.(%d+)$")
|
||||||
else
|
else
|
||||||
datetime_taken = "0000:00:00 00:00:00"
|
emsec = "0"
|
||||||
end
|
eyear, emon, eday, ehour, emin, esec =
|
||||||
end
|
string.match(datetime_taken, "(%d+):(%d+):(%d+) (%d+):(%d+):(%d+)$")
|
||||||
|
end
|
||||||
local eyear, emon, eday, ehour, emin, esec, emsec
|
|
||||||
if use_millisecs then
|
|
||||||
eyear, emon, eday, ehour, emin, esec, emsec =
|
|
||||||
string.match(datetime_taken, "(%d+):(%d+):(%d+) (%d+):(%d+):(%d+)%.(%d+)$")
|
|
||||||
else
|
else
|
||||||
emsec = "0"
|
log.msg(log.warn, "no capture date and time found in EXIF data")
|
||||||
eyear, emon, eday, ehour, emin, esec =
|
emon_long, emon_short, eyear, emon, eday, ehour, emin, esec, emsec = ""
|
||||||
string.match(datetime_taken, "(%d+):(%d+):(%d+) (%d+):(%d+):(%d+)$")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local version_multi = #image:get_group_members() > 1 and image.duplicate_index or ""
|
local version_multi = #image:get_group_members() > 1 and image.duplicate_index or ""
|
||||||
|
|
||||||
local replacements = {dtutils_string.get_basename(image.film.path),-- ROLL.NAME
|
local replacements = {dtutils_string.get_basename(image.film.path),-- ROLL.NAME
|
||||||
@@ -838,10 +834,10 @@ function dtutils_string.build_substitute_list(image, sequence, variable_string,
|
|||||||
string.format("%02d", datetime.sec), -- SECOND
|
string.format("%02d", datetime.sec), -- SECOND
|
||||||
0, -- MSEC
|
0, -- MSEC
|
||||||
eyear, -- EXIF.YEAR
|
eyear, -- EXIF.YEAR
|
||||||
string.sub(eyear, 3), -- EXIF.YEAR.SHORT
|
(eyear ~= nil) and string.sub(eyear, 3) or "", -- EXIF.YEAR.SHORT
|
||||||
emon, -- EXIF.MONTH
|
emon, -- EXIF.MONTH
|
||||||
os.date("%B", exiftime2systime(datetime_taken)), -- EXIF.MONTH.LONG
|
emon_long, -- EXIF.MONTH.LONG
|
||||||
os.date("%b", exiftime2systime(datetime_taken)), -- EXIF.MONTH.SHORT
|
emon_short, -- EXIF.MONTH.SHORT
|
||||||
eday, -- EXIF.DAY
|
eday, -- EXIF.DAY
|
||||||
ehour, -- EXIF.HOUR
|
ehour, -- EXIF.HOUR
|
||||||
"", -- EXIF.HOUR.AMPM
|
"", -- EXIF.HOUR.AMPM
|
||||||
|
|||||||
Reference in New Issue
Block a user