Skip to content

Commit a0ad304

Browse files
committed
Optional no-config/profile/debug logs for sub-mpvs
Fixes #4. (Maybe the debug logs should be enabled by default, and deleted on success. Hmm.)
1 parent 1a8c3e1 commit a0ad304

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/options.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ local thumbnailer_options = {
1919

2020
-- Explicitly disable subtitles on the mpv sub-calls
2121
mpv_no_sub = false,
22+
-- Add a "--no-config" to the mpv sub-call arguments
23+
mpv_no_config = false,
24+
-- Add a "--profile=<mpv_profile>" to the mpv sub-call arguments
25+
-- Use "" to disable
26+
mpv_profile = "",
27+
-- Output debug logs to <thumbnail_path>.log, ala <cache_directory>/<video_filename>/000000.bgra.log
28+
mpv_log = false,
2229

2330
-- Disable the built-in keybind ("T") to add your own
2431
disable_keybinds = false,

src/thumbnailer_server.lua

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,30 @@ end
99
function create_thumbnail_mpv(file_path, timestamp, size, output_path)
1010
local ytdl_disabled = mp.get_property_native("ytdl") == false or thumbnailer_options.remote_direct_stream
1111

12+
local profile_arg = nil
13+
if thumbnailer_options.mpv_profile ~= "" then
14+
profile_arg = "--profile=" .. thumbnailer_options.mpv_profile
15+
end
16+
17+
local log_arg = "--log-file=" .. output_path .. ".log"
18+
1219
local mpv_command = skip_nil({
1320
"mpv",
1421
-- Hide console output
1522
"--msg-level=all=no",
16-
file_path,
1723

1824
-- Disable ytdl
1925
(ytdl_disabled and "--no-ytdl" or nil),
2026
-- Disable hardware decoding
2127
"--hwdec=no",
2228

29+
-- Insert --no-config, --profile=... and --log-file if enabled
30+
(thumbnailer_options.mpv_no_config and "--no-config" or nil),
31+
profile_arg,
32+
(thumbnailer_options.mpv_log and log_arg or nil),
33+
34+
file_path,
35+
2336
"--start=" .. tostring(timestamp),
2437
"--frames=1",
2538
"--hr-seek=yes",

0 commit comments

Comments
 (0)