@@ -29,7 +29,7 @@ function create_thumbnail_mpv(file_path, timestamp, size, output_path)
2929 -- Insert --no-config, --profile=... and --log-file if enabled
3030 (thumbnailer_options .mpv_no_config and " --no-config" or nil ),
3131 profile_arg ,
32- (thumbnailer_options .mpv_log and log_arg or nil ),
32+ (thumbnailer_options .mpv_logs and log_arg or nil ),
3333
3434 file_path ,
3535
@@ -72,23 +72,35 @@ function create_thumbnail_ffmpeg(file_path, timestamp, size, output_path)
7272end
7373
7474
75- function check_output (ret , output_path )
75+ function check_output (ret , output_path , is_mpv )
76+ local log_path = output_path .. " .log"
77+ local success = true
78+
7679 if ret .killed_by_us then
7780 return nil
78- end
79-
80- local success = true
81+ else
82+ if ret .error or ret .status ~= 0 then
83+ msg .error (" Thumbnailing command failed!" )
84+ msg .error (ret .error )
85+ msg .error (ret .stdout )
86+ if is_mpv then
87+ msg .error (" Debug log:" , log_path )
88+ end
8189
82- if ret .error or ret .status ~= 0 then
83- msg .error (" Thumbnailing command failed!" )
84- msg .error (ret .error or ret .stdout )
90+ success = false
91+ end
8592
86- success = false
93+ if not file_exists (output_path ) then
94+ msg .error (" Output file missing!" , output_path )
95+ success = false
96+ end
8797 end
8898
89- if not file_exists (output_path ) then
90- msg .error (" Output file missing!" , output_path )
91- success = false
99+ if is_mpv and not thumbnailer_options .mpv_keep_logs then
100+ -- Remove successful debug logs
101+ if success and file_exists (log_path ) then
102+ os.remove (log_path )
103+ end
92104 end
93105
94106 return success
@@ -159,7 +171,7 @@ function do_worker_job(state_json_string, frames_json_string)
159171
160172 if need_thumbnail_generation then
161173 local ret = thumbnail_func (file_path , timestamp , thumb_state .thumbnail_size , thumbnail_path )
162- local success = check_output (ret , thumbnail_path )
174+ local success = check_output (ret , thumbnail_path , thumbnail_func == create_thumbnail_mpv )
163175
164176 if success == nil then
165177 -- Killed by us, changing files, ignore
0 commit comments