Update slideshowMusic.lua

use "lib/dtutils.file"
This commit is contained in:
supertobi
2017-04-27 21:55:19 +02:00
committed by GitHub
parent dee7ee1dde
commit d46b7e4aaf

View File

@@ -25,9 +25,10 @@ USAGE
]]
local dt = require "darktable"
local df = require "lib/dtutils.file"
require "official/yield"
local gettext = dt.gettext
dt.configuration.check_version(...,{2,0,2},{3,0,0},{4,0,0})
-- Tell gettext where to find the .mo file translating messages for a particular domain
@@ -37,26 +38,14 @@ local function _(msgid)
return gettext.dgettext("slideshowMusic", msgid)
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 playSlideshowMusic(_, old_view, new_view)
local filename, playMusic
filename = dt.preferences.read("slideshowMusic","SlideshowMusic","string")
playMusic = dt.preferences.read("slideshowMusic","PlaySlideshowMusic","bool")
if not checkIfBinExists("rhythmbox-client") then
if not df.check_if_bin_exists("rhythmbox-client") then
dt.print_error(_("rhythmbox-client not found"))
return
end