function "dtutils.string.substitute()" fails when no time data is provided in Exif data
还没有人认领这个 Issue。
评估
调研方向
先在 lua/lib/dtutils/string.lua 中阅读 build_substitute_list 和 exiftime2systime,然后针对没有 EXIF 时间数据的图像运行所报告的替换脚本。在受影响的系统上默认时间戳能够被接受且不出现 os.time 错误,即表示完成。
由索引模型根据 Issue 内容生成。
描述
When running a script using "dtutils.string.substitute()" function on a file without any time data in Exif, the "dtutils.string.substitute()" function fails.
190.9832 LUA ERROR : ...\AppData\Local\darktable/lua/lib/dtutils\string.lua:748: time result cannot be represented in this installation
stack traceback:
[C]: in ?
[C]: in function 'os.time'
...AppData\Local\darktable/lua/lib/dtutils\string.lua:748: in upvalue 'exiftime2systime'
...AppData\Local\darktable/lua/lib/dtutils\string.lua:843: in function 'lib/dtutils.string.build_substitute_list'
...AppData\Local\darktable/lua/lib/dtutils\string.lua:1298: in function 'lib/dtutils.string.substitute'
After looking at the "string.lua" code, it seems that "build_substitute_list" function tries to use "0000:00:00 00:00:00" as default value if the exif time is not available, but the "os.time{}" conversion called later through "exiftime2systime(datetime_taken)" does not like it. The minimum time value accepted on several systems is January 1st, 1970. I updated the "string.lua" code on my installation (replacing "0000:00:00 00:00:00" with "1970:01:01 00:00:00") and this fixes the issue.
Code from string.lua :
local function exiftime2systime(exiftime)
local yr,mo,dy,h,m,s = string.match(exiftime, "(%d-):(%d-):(%d-) (%d-):(%d-):(%d+)")
return(os.time{year=yr, month=mo, day=dy, hour=h, min=m, sec=s})
end
[...]
function dtutils_string.build_substitute_list(image, sequence, variable_string, username, pic_folder, home, desktop)
[...]
if image.exif_datetime_taken and image.exif_datetime_taken ~= "" then
datetime_taken = image.exif_datetime_taken
else
if use_millisecs then
datetime_taken = "0000:00:00 00:00:00.0"
else
datetime_taken = "0000:00:00 00:00:00"
end
end
[...]
I see this issue on Windows 11, DarkTable 5.4.0. Other systems could behave the same, or not.
- 主要语言
- Lua
- 星标
- 219
- 派生
- 142
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
darktable-org/lua-scripts 的其他 Issue
-
dtutils.string: build_substitute_list errors when a metadata field (e.g. rights) has been removed 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
darktable-org/lua-scripts#716 · 2 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 63/100
darktable-org/lua-scripts#706 ·
-
bug
难度 1/5 1 小时以内 新手友好度 65/100
darktable-org/lua-scripts#618 · 3 条评论 ·
-
难度 3/5 1-2 天 新手友好度 52/100
darktable-org/lua-scripts#710 · 3 条评论 ·
-
难度 4/5 3-5 天 新手友好度 45/100
darktable-org/lua-scripts#708 · 1 条评论 ·
查看 darktable-org/lua-scripts 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
-
bug
难度 2/5 1-3 小时 新手友好度 84/100
-
难度 1/5 1 小时以内 新手友好度 90/100
-
[Eco] Egg Config 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
pterodactyl/game-eggs#634 ·
-
Feature Request
难度 1/5 1 小时以内 新手友好度 72/100
Questie/QuestieTrace#33 ·