Skip to content

Commit 4d76006

Browse files
authored
Merge pull request darktable-org#97 from jbvoelker/select-untagged
Selection of untagged images
2 parents 0f0b3d6 + 731a6d0 commit 4d76006

File tree

3 files changed

+118
-0
lines changed

3 files changed

+118
-0
lines changed

contrib/select_untagged.lua

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
--[[
2+
This file is part of darktable,
3+
copyright (c) 2017 Jannis_V
4+
5+
darktable is free software: you can redistribute it and/or modify
6+
it under the terms of the GNU General Public License as published by
7+
the Free Software Foundation, either version 3 of the License, or
8+
(at your option) any later version.
9+
darktable is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
GNU General Public License for more details.
13+
You should have received a copy of the GNU General Public License
14+
along with darktable. If not, see <http://www.gnu.org/licenses/>.
15+
]]
16+
17+
--[[
18+
Enable selection of untagged images (darktable|* tags are ignored)
19+
]]
20+
21+
local dt = require "darktable"
22+
local gettext = dt.gettext
23+
24+
dt.configuration.check_version(...,{3,0,0},{4,0,0},{5,0,0})
25+
26+
-- Tell gettext where to find the .mo file translating messages for a particular domain
27+
gettext.bindtextdomain("select_untagged",dt.configuration.config_dir.."/lua/locale/")
28+
29+
local function _(msgid)
30+
return gettext.dgettext("select_untagged", msgid)
31+
end
32+
33+
local function stop_job(job)
34+
job.valid = false
35+
end
36+
37+
local function select_untagged_images()
38+
job = dt.gui.create_job(_("select untagged images"), true, stop_job)
39+
40+
local selection = {}
41+
42+
for key,image in ipairs(dt.collection) do
43+
if(job.valid) then
44+
job.percent = (key-1)/#dt.collection
45+
local tags = dt.tags.get_tags(image)
46+
local hasTags = false
47+
for _,tag in ipairs(tags) do
48+
if not string.match(tag.name,"darktable|") then
49+
hasTags = true
50+
end
51+
end
52+
if hasTags == false then
53+
table.insert(selection,image)
54+
end
55+
else
56+
break
57+
end
58+
end
59+
60+
job.valid = false
61+
dt.gui.selection(selection)
62+
end
63+
64+
dt.gui.libs.select.register_selection(_("select untagged"),select_untagged_images,_("select all images containing no tags or only tags added by darktable"))
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
msgid ""
2+
msgstr ""
3+
"Project-Id-Version: \n"
4+
"POT-Creation-Date: 2017-09-14 12:18+0200\n"
5+
"PO-Revision-Date: 2017-09-14 12:23+0200\n"
6+
"Last-Translator: Jannis_V\n"
7+
"Language-Team: \n"
8+
"Language: de_DE\n"
9+
"MIME-Version: 1.0\n"
10+
"Content-Type: text/plain; charset=UTF-8\n"
11+
"Content-Transfer-Encoding: 8bit\n"
12+
"X-Generator: Poedit 1.8.7.1\n"
13+
"X-Poedit-Basepath: ../../../contrib\n"
14+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
15+
"X-Poedit-SearchPath-0: select_untagged.lua\n"
16+
17+
#: select_untagged.lua:38
18+
msgid "select untagged images"
19+
msgstr "Auswahl von Bildern ohne Tags"
20+
21+
#: select_untagged.lua:64
22+
msgid "select untagged"
23+
msgstr "Ohne Tags"
24+
25+
#: select_untagged.lua:64
26+
msgid "select all images containing no tags or only tags added by darktable"
27+
msgstr "Wähle alle Bilder der aktuellen Sammlung aus, die keine Tags oder nur automatisch durch darktable erzeugte Tags enthalten"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
msgid ""
2+
msgstr ""
3+
"Project-Id-Version: \n"
4+
"POT-Creation-Date: 2017-09-14 15:42+0200\n"
5+
"PO-Revision-Date: 2017-09-14 15:52+0200\n"
6+
"Last-Translator: Jannis_V\n"
7+
"Language-Team: \n"
8+
"Language: fr_FR\n"
9+
"MIME-Version: 1.0\n"
10+
"Content-Type: text/plain; charset=UTF-8\n"
11+
"Content-Transfer-Encoding: 8bit\n"
12+
"X-Generator: Poedit 1.8.7.1\n"
13+
"X-Poedit-Basepath: ../../../contrib\n"
14+
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
15+
"X-Poedit-SearchPath-0: select_untagged.lua\n"
16+
17+
#: select_untagged.lua:38
18+
msgid "select untagged images"
19+
msgstr "sélection des images sans mots-clés"
20+
21+
#: select_untagged.lua:64
22+
msgid "select untagged"
23+
msgstr "sans mots-clés"
24+
25+
#: select_untagged.lua:64
26+
msgid "select all images containing no tags or only tags added by darktable"
27+
msgstr "sélection des images sans mots-clés ou seulement avec les mots-clés ajoutés par darktable"

0 commit comments

Comments
 (0)