diff --git a/locale/de_DE/LC_MESSAGES/open_ooc.mo b/locale/de_DE/LC_MESSAGES/open_ooc.mo new file mode 100644 index 0000000..7e00f75 Binary files /dev/null and b/locale/de_DE/LC_MESSAGES/open_ooc.mo differ diff --git a/locale/de_DE/LC_MESSAGES/open_ooc.po b/locale/de_DE/LC_MESSAGES/open_ooc.po new file mode 100644 index 0000000..fa7a220 --- /dev/null +++ b/locale/de_DE/LC_MESSAGES/open_ooc.po @@ -0,0 +1,42 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-04-10 10:55+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: open_ooc.lua:76 +msgid "open ooc jpeg" +msgstr "JPG öffnen" + +#: open_ooc.lua:77 +msgid "open associated ooc jpegs for selected raw files" +msgstr "öffne die zu den ausgewählten RAW-Dateien gehörenden Kamera-JPGs" + +#: open_ooc.lua:96 +msgid "please select an image" +msgstr "kein Bild ausgewählt" + +#: open_ooc.lua:111 +msgid "selection empty, or no jpeg available" +msgstr "kein Bild ausgewählt oder JPG nicht vorhanden" + +#: open_ooc.lua:130 +msgid "open jpeg" +msgstr "JPG öffnen" + +#: open_ooc.lua:132 +msgid "open associated ooc jpegs for the selected raw files" +msgstr "öffne die zu den ausgewählten RAW-Dateien gehörenden Kamera-JPGs" diff --git a/open_ooc.lua b/open_ooc.lua index 44341a2..1836dab 100644 --- a/open_ooc.lua +++ b/open_ooc.lua @@ -73,8 +73,8 @@ end local script_data = {} script_data.metadata = { - name = _("open OoC JPEG"), - purpose = _("open associated OoC JPEGs for selected RAW files"), + name = _("open ooc jpeg"), + purpose = _("open associated ooc jpegs for selected raw files"), author = "Florian Tham ", help = "https://docs.darktable.org/lua/stable/lua.scripts.manual/scripts/contrib/open_ooc" } @@ -84,20 +84,38 @@ script_data.destroy_method = nil -- set to hide for libs since we can't destroy script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again script_data.show = nil -- only required for libs since the destroy_method only hides them +local viewer = {} +viewer.executable = "sxiv" +viewer.args = "" + local function open_ooc() --finalize - local images = dt.gui.selection() + local selected_images = dt.gui.selection() local file_list = "" - if #images == 0 then + if #selected_images == 0 then dt.print(_("please select an image")) return end - for _, image in pairs(images) do - file_list = file_list .. image .. " " - dt.print(image) + for _, image in pairs(selected_images) do + if df.get_filetype(image.filename) == "CR3" then + current_image = image.path .. os_path_seperator .. image.filename + current_image = string.gsub(current_image, ".CR3", ".JPG") + if df.check_if_file_exists(current_image) then + file_list = file_list .. current_image .. " " + end + end end - dt.print(file_list) + + if file_list == "" then + dt.print(_("selection empty, or no jpeg available")) + return + end + + + cmd = viewer.executable .. " " .. viewer.args .. " " .. file_list + dt.print_log("open_ooc: " .. cmd) + dtsys.external_command(cmd) end @@ -109,15 +127,15 @@ end -- Register dt.gui.libs.image.register_action( - MODULE, _("open associated OoC JPEGs"), + MODULE, _("open jpeg"), function() open_ooc() end, - _("open associated OoC JPEGs for the selected raw files") + _("open associated ooc jpegs for the selected raw files") ) dt.register_event( MODULE, "shortcut", - function(event, shortcut), open_ooc() end, + function(event, shortcut) open_ooc() end, MODULE )