From af9695f98e8b221a31fa5ff4ec1b5893a524069c Mon Sep 17 00:00:00 2001 From: datasone Date: Wed, 1 Feb 2023 19:08:48 +0800 Subject: [PATCH] Makes shot_path configurable, fixes #13 --- notify_media.conf | 2 ++ notify_media.lua | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/notify_media.conf b/notify_media.conf index af7b77f..987bf9a 100644 --- a/notify_media.conf +++ b/notify_media.conf @@ -3,6 +3,8 @@ debug=no # Path to executable (MPVMediaControl.exe) binary_path=~~/bin/MPVMediaControl.exe +# Path for storing temporary screenshots +shot_path=~~/ # If you want to delay taking screenshot for videos, set this to the number of delayed seconds delayed_sec=3 # Name of mpv's input-ipc-server (defaults to mpvsocket_{pid}), it shall be useful when multiple scripts set up the IPC socket for controls. diff --git a/notify_media.lua b/notify_media.lua index 408a29a..c0c5196 100644 --- a/notify_media.lua +++ b/notify_media.lua @@ -6,6 +6,8 @@ local o = { debug = false, -- Path to executable (MPVMediaControl.exe) binary_path = "~~/bin/MPVMediaControl.exe", + -- Path for storing temporary screenshots + shot_path = "~~/", -- If you want to delay taking screenshot for videos, set this to the number of delayed seconds delayed_sec = 3, -- Name of mpv's input-ipc-server (defaults to mpvsocket_{pid}), string "{pid}" in the value will be automatically replaced with the ID of mpv process @@ -195,8 +197,8 @@ function notify_metadata_updated() end path = encode_element(path) - local user_path = mp.command_native({"expand-path", "~~/"}) - shot_path = user_path .. "\\" .. pid .. ".jpg" + local shot_dir = mp.command_native({ "expand-path", o.shot_path }) + shot_path = shot_dir .. "\\" .. pid .. ".jpg" if mp.get_property("video-codec") then save_shot(shot_path) end