@@ -54,32 +54,35 @@ script_data.restart = nil -- how to restart the (lib) script after it's been hid
54
54
script_data .show = nil -- only required for libs since the destroy_method only hides them
55
55
56
56
local function detect_rating (event , image )
57
+ if not string.match (image .filename , " %.RAF$" ) and not string.match (image .filename , " %.raf$" ) then
58
+ return
59
+ end
57
60
if not df .check_if_bin_exists (" exiftool" ) then
58
61
dt .print_error (_ (" exiftool not found" ))
59
62
return
60
63
end
61
64
local RAF_filename = df .sanitize_filename (tostring (image ))
62
65
local JPEG_filename = string.gsub (RAF_filename , " %.RAF$" , " .JPG" )
63
66
local command = " exiftool -Rating " .. JPEG_filename
64
- dt .print_error (command )
67
+ dt .print_log (command )
65
68
local output = dtsys .io_popen (command )
66
69
local jpeg_result = output :read (" *all" )
67
70
output :close ()
68
71
if string.len (jpeg_result ) > 0 then
69
72
jpeg_result = string.gsub (jpeg_result , " ^Rating.*(%d)" , " %1" )
70
73
image .rating = tonumber (jpeg_result )
71
- dt .print_error ( string.format ( _ ( " using JPEG rating: %d " ), jpeg_result ) )
74
+ dt .print_log ( " using JPEG rating: " .. jpeg_result )
72
75
return
73
76
end
74
77
command = " exiftool -Rating " .. RAF_filename
75
- dt .print_error (command )
78
+ dt .print_log (command )
76
79
output = dtsys .io_popen (command )
77
80
local raf_result = output :read (" *all" )
78
81
output :close ()
79
82
if string.len (raf_result ) > 0 then
80
83
raf_result = string.gsub (raf_result , " ^Rating.*(%d)" , " %1" )
81
84
image .rating = tonumber (raf_result )
82
- dt .print_error ( string.format ( _ ( " using RAF rating: %d " ), raf_result ) )
85
+ dt .print_log ( " using RAF rating: " .. raf_result )
83
86
end
84
87
end
85
88
0 commit comments