From b737d2878091818b6083326b60f87eb277e9c758 Mon Sep 17 00:00:00 2001 From: Tobias Jakobs Date: Fri, 26 Dec 2014 19:05:20 +0100 Subject: [PATCH] add checkIfBinExists --- contrib/video.lua | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/contrib/video.lua b/contrib/video.lua index f981f5e..c94ab5e 100644 --- a/contrib/video.lua +++ b/contrib/video.lua @@ -37,7 +37,29 @@ local function show_status(storage, image, format, filename, number, total, high 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 (not result) then + dt.print_error(bin.." not found") + ret = false + end + ret = true + return ret +end + local function create_video(storage, image_table, extra_data) + if not checkIfBinExists("mencoder") then + return + end + if not checkIfBinExists("xdg-open") then + return + end + if not checkIfBinExists("xdg-user-dir") then + return + end exportDirectory = dt.preferences.read("video","ExportDirectory","string") exportFilename = "output.avi"