From 01fc339da531cb120741acea5ff5d3ec3de16778 Mon Sep 17 00:00:00 2001 From: supertobi Date: Thu, 27 Apr 2017 21:46:30 +0200 Subject: [PATCH] Update video_mencoder.lua use "lib/dtutils.file" and gettext --- contrib/video_mencoder.lua | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/contrib/video_mencoder.lua b/contrib/video_mencoder.lua index db095b5..e834f67 100644 --- a/contrib/video_mencoder.lua +++ b/contrib/video_mencoder.lua @@ -31,38 +31,34 @@ USAGE ]] local dt = require "darktable" +local df = require "lib/dtutils.file" require "official/yield" +local gettext = dt.gettext dt.configuration.check_version(...,{2,0,1},{3,0,0},{4,0,0}) +-- Tell gettext where to find the .mo file translating messages for a particular domain +gettext.bindtextdomain("video_mencoder",dt.configuration.config_dir.."/lua/locale/") + +local function _(msgid) + return gettext.dgettext("video_mencoder", msgid) +end + local function show_status(storage, image, format, filename, number, total, high_quality, extra_data) dt.print("Export Image "..tostring(number).."/"..tostring(total)) end -local function checkIfBinExists(bin) - local handle = io.popen("which "..bin) - local result = handle:read() - local ret - handle:close() - if (result) then - --dt.print_error("true checkIfBinExists: "..bin) - ret = true - else - dt.print_error(bin.." not found") - ret = false - end - - return ret -end - local function create_video_mencoder(storage, image_table, extra_data) - if not checkIfBinExists("mencoder") then + if not df.check_if_bin_exists("mencoder") then + dt.print_error(_("mencoder not found")) return end - if not checkIfBinExists("xdg-open") then + if not df.check_if_bin_exists("xdg-open") then + dt.print_error(_("xdg-open not found")) return end - if not checkIfBinExists("xdg-user-dir") then + if not df.check_if_bin_exists("xdg-user-dir") then + dt.print_error(_("xdg-user-dir not found")) return end