22-04-17, 17:12
Tel quel, Le script ne fonctionne pas quand il doit ouvrir un dossier dont le nom contient une apostrophe ou un guillemet.
Voici une nouvelle version corrigeant ce bug.
Au passage, merci à Manu pour m'avoir suggéré ce besoin. Maintenant j'utilise ce script tout le temps !
Voici une nouvelle version corrigeant ce bug.
Au passage, merci à Manu pour m'avoir suggéré ce besoin. Maintenant j'utilise ce script tout le temps !
Code :
--[[
FNAV
launch file navigator in photo directory with a shortcut
AUTHOR
Jean-Pirre Verrue (contact@jpverrue.fr)
INSTALLATION
* copy this file in $CONFIGDIR/lua/ where CONFIGDIR
is your darktable configuration directory
* add the following line in the file $CONFIGDIR/luarc
require "fnav"
USAGE
* configure this script :
* set a shortcut in preferences->shortcut->lua
* set file navigator path in preferences->lua options
* set file navigator options in preferences->lua options
* select a photo
* type your shortcut
* after use dont forget to close file navigator window !
LICENSE
GPLv2
]]
local dt = require "darktable"
dt.preferences.register("file_navigator","navigator_options",
"string","options",
"options du navigateur de fichier","")
dt.preferences.register("file_navigator","navigator_path",
"string","navigateur de fichiers",
"chemin complet du navigateur de fichier","")
local function fnav_shortcut(event, shortcut)
local images = dt.gui.action_images
local image_path = string.gsub(tostring(images[1].path), '"', '\\"')
local navigator_path = dt.preferences.read("file_navigator", "navigator_path", "string")
local navigator_options = dt.preferences.read("file_navigator", "navigator_options", "string")
local command = navigator_path.." "..navigator_options..' "'..image_path..'"'
dt.print_error("command="..command)
dt.control.execute(command)
end
dt.register_event("shortcut",fnav_shortcut,
"Lancer le navigateur de fichiers")
Mes photos : jpverrue.fr