From ecc4a29be42f5253286e014360d224a7d7b80f85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jannis=20V=C3=B6lker?= Date: Wed, 13 Sep 2017 17:26:47 +0200 Subject: [PATCH 1/3] Select all untagged images in the collection. Pictures containg only automatic tags added by darktable are also considered untagged --- contrib/select_untagged.lua | 65 +++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 contrib/select_untagged.lua diff --git a/contrib/select_untagged.lua b/contrib/select_untagged.lua new file mode 100644 index 0000000..1d92d24 --- /dev/null +++ b/contrib/select_untagged.lua @@ -0,0 +1,65 @@ +--[[ + This file is part of darktable, + copyright (c) 2017 Jannis_V + + darktable is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + darktable is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + You should have received a copy of the GNU General Public License + along with darktable. If not, see . +]] + +--[[ +Enable selection of untagged images (darktable|* tags are ignored) +]] + +local dt = require "darktable" +require "official/yield" +local gettext = dt.gettext + +dt.configuration.check_version(...,{3,0,0},{4,0,0},{5,0,0}) + +-- Tell gettext where to find the .mo file translating messages for a particular domain +gettext.bindtextdomain("select_untagged",dt.configuration.config_dir.."/lua/locale/") + +local function _(msgid) + return gettext.dgettext("select_untagged", msgid) +end + +local function stop_job(job) + job.valid = false +end + +local function select_untagged_images() + job = dt.gui.create_job(_("select untagged images"), true, stop_job) + + local selection = {} + + for key,image in ipairs(dt.collection) do + if(job.valid) then + job.percent = (key-1)/#dt.collection + local tags = dt.tags.get_tags(image) + local hasTags = false + for _,tag in ipairs(tags) do + if not string.match(tag.name,"darktable|") then + hasTags = true + end + end + if hasTags == false then + table.insert(selection,image) + end + else + break + end + end + + job.valid = false + dt.gui.selection(selection) +end + +dt.gui.libs.select.register_selection(_("select untagged"),select_untagged_images,_("select all images containing no tags or only tags added by darktable")) From e4542aa451fb2a44d3eb7d9b81aa7ea1d4ec887d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jannis=20V=C3=B6lker?= Date: Thu, 14 Sep 2017 11:52:05 +0200 Subject: [PATCH 2/3] Remove require --- contrib/select_untagged.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/contrib/select_untagged.lua b/contrib/select_untagged.lua index 1d92d24..9e504c0 100644 --- a/contrib/select_untagged.lua +++ b/contrib/select_untagged.lua @@ -19,7 +19,6 @@ Enable selection of untagged images (darktable|* tags are ignored) ]] local dt = require "darktable" -require "official/yield" local gettext = dt.gettext dt.configuration.check_version(...,{3,0,0},{4,0,0},{5,0,0}) From 731a6d04107a96daec10c2e2c8ee97a05466026e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jannis=20V=C3=B6lker?= Date: Thu, 14 Sep 2017 16:00:48 +0200 Subject: [PATCH 3/3] German and french translation for the select_untagged script --- locale/de_DE/LC_MESSAGES/select_untagged.po | 27 +++++++++++++++++++++ locale/fr_FR/LC_MESSAGES/select_untagged.po | 27 +++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 locale/de_DE/LC_MESSAGES/select_untagged.po create mode 100644 locale/fr_FR/LC_MESSAGES/select_untagged.po diff --git a/locale/de_DE/LC_MESSAGES/select_untagged.po b/locale/de_DE/LC_MESSAGES/select_untagged.po new file mode 100644 index 0000000..5a1f78b --- /dev/null +++ b/locale/de_DE/LC_MESSAGES/select_untagged.po @@ -0,0 +1,27 @@ +msgid "" +msgstr "" +"Project-Id-Version: \n" +"POT-Creation-Date: 2017-09-14 12:18+0200\n" +"PO-Revision-Date: 2017-09-14 12:23+0200\n" +"Last-Translator: Jannis_V\n" +"Language-Team: \n" +"Language: de_DE\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.8.7.1\n" +"X-Poedit-Basepath: ../../../contrib\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Poedit-SearchPath-0: select_untagged.lua\n" + +#: select_untagged.lua:38 +msgid "select untagged images" +msgstr "Auswahl von Bildern ohne Tags" + +#: select_untagged.lua:64 +msgid "select untagged" +msgstr "Ohne Tags" + +#: select_untagged.lua:64 +msgid "select all images containing no tags or only tags added by darktable" +msgstr "Wähle alle Bilder der aktuellen Sammlung aus, die keine Tags oder nur automatisch durch darktable erzeugte Tags enthalten" diff --git a/locale/fr_FR/LC_MESSAGES/select_untagged.po b/locale/fr_FR/LC_MESSAGES/select_untagged.po new file mode 100644 index 0000000..3a21d56 --- /dev/null +++ b/locale/fr_FR/LC_MESSAGES/select_untagged.po @@ -0,0 +1,27 @@ +msgid "" +msgstr "" +"Project-Id-Version: \n" +"POT-Creation-Date: 2017-09-14 15:42+0200\n" +"PO-Revision-Date: 2017-09-14 15:52+0200\n" +"Last-Translator: Jannis_V\n" +"Language-Team: \n" +"Language: fr_FR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.8.7.1\n" +"X-Poedit-Basepath: ../../../contrib\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" +"X-Poedit-SearchPath-0: select_untagged.lua\n" + +#: select_untagged.lua:38 +msgid "select untagged images" +msgstr "sélection des images sans mots-clés" + +#: select_untagged.lua:64 +msgid "select untagged" +msgstr "sans mots-clés" + +#: select_untagged.lua:64 +msgid "select all images containing no tags or only tags added by darktable" +msgstr "sélection des images sans mots-clés ou seulement avec les mots-clés ajoutés par darktable"