18
18
along with darktable. If not, see <http://www.gnu.org/licenses/>.
19
19
]]
20
20
--[[
21
- VERSION 0.3
22
-
21
+ VERSION 2.1
22
+ Works with darktable 2.0.X and 2.2.X
23
+
23
24
ADDITIONAL SOFTWARE NEEDED FOR THIS SCRIPT
24
25
* sqlite3
25
26
* rm
@@ -38,7 +39,7 @@ ADDITIONAL SOFTWARE NEEDED FOR THIS SCRIPT
38
39
39
40
local dt = require " darktable"
40
41
local gettext = dt .gettext
41
- dt .configuration .check_version (... ,{3 ,0 ,0 })
42
+ dt .configuration .check_version (... ,{3 ,0 ,0 },{ 4 , 0 , 0 } )
42
43
43
44
local count_discusage = " -"
44
45
local count_filmrolls = " -"
@@ -193,7 +194,16 @@ local function checkIfBinExists(bin)
193
194
end
194
195
return ret
195
196
end
196
-
197
+
198
+ local function checkIfDirExists (dir )
199
+ local dir_found = io.open (dir , " r" )
200
+ if dir_found == nil then
201
+ dt .print (_ ([[ ERROR: Directory not found. Please check ]] .. dir ))
202
+
203
+ end
204
+ end
205
+
206
+
197
207
198
208
function round (num , idp )
199
209
local mult = 10 ^ (idp or 0 )
@@ -246,15 +256,20 @@ local function analyse_db()
246
256
local totalrating3 = 0
247
257
local totalrating4 = 0
248
258
local totalrating5 = 0
259
+
260
+
249
261
-- Calculate Rating
250
262
while counter ~= number_filmrolls do
251
263
-- Input dir
252
264
InputdirStartCommand = [[ sqlite3 ~/.config/darktable/library.db "SELECT folder FROM film_rolls LIMIT ]] .. counter .. [[ ,1" > /tmp/dt_inputdir]]
253
265
os.execute (InputdirStartCommand )
254
266
local file_inputdir = io.open (" /tmp/dt_inputdir" , " r" )
255
- inputdir = file_inputdir :read ()
267
+ xinputdir = file_inputdir :read ()
268
+ inputdir = ' "' .. xinputdir .. ' "'
256
269
file_inputdir :close ()
257
270
os.execute [[ rm /tmp/dt_inputdir]]
271
+ -- Check Inputdir
272
+ checkIfDirExists (xinputdir )
258
273
-- Disc usage
259
274
DiscusageStartCommand = [[ du -s ]] .. inputdir .. [[ | cut -f1 > /tmp/dt_discusage]]
260
275
os.execute (DiscusageStartCommand )
0 commit comments