update
This commit is contained in:
parent
087f16dfd0
commit
f3a4afcf76
2
mpv.conf
2
mpv.conf
@ -11,7 +11,7 @@ border=no
|
||||
# geometry=50%
|
||||
autofit=50%
|
||||
volume=75
|
||||
audio-spdif=ac3,eac3,dts-hd,truehd
|
||||
audio-spdif=ac3,dts-hd,truehd
|
||||
# glsl-shaders="~~/shaders/Anime4K_Clamp_Highlights.glsl:~~/shaders/Anime4K_Restore_CNN_VL.glsl:~~/shaders/Anime4K_Upscale_CNN_x2_VL.glsl:~~/shaders/Anime4K_AutoDownscalePre_x2.glsl:~~/shaders/Anime4K_AutoDownscalePre_x4.glsl:~~/shaders/Anime4K_Upscale_CNN_x2_M.glsl"
|
||||
# glsl-shaders="~~/shaders/FSRCNNX.glsl:~~/shaders/FSR.glsl:~~/shaders/NVScaler.glsl:~~/shaders/CAS-scaled.glsl"
|
||||
# glsl-shaders="~~/shaders/ArtCNN_C4F32_DS.glsl"
|
||||
|
@ -8,75 +8,75 @@ local platform = mp.get_property_native("platform")
|
||||
local config_file_path = mp.find_config_file("mpv.conf")
|
||||
local config_folder_path, config_file = utils.split_path(config_file_path)
|
||||
local mpv_websocket_path =
|
||||
utils.join_path(config_folder_path, platform == "windows" and "mpv_websocket.exe" or "mpv_websocket")
|
||||
utils.join_path(config_folder_path, platform == "windows" and "mpv_websocket.exe" or "mpv_websocket")
|
||||
local initialised_websocket
|
||||
|
||||
local _, err = utils.file_info(config_file_path)
|
||||
if err then
|
||||
error("failed to open mpv config file `" .. config_file_path .. "`")
|
||||
error("failed to open mpv config file `" .. config_file_path .. "`")
|
||||
end
|
||||
|
||||
local _, err = utils.file_info(mpv_websocket_path)
|
||||
if err then
|
||||
error("failed to open mpv_websocket")
|
||||
error("failed to open mpv_websocket")
|
||||
end
|
||||
|
||||
local function find_mpv_socket(config_file_path)
|
||||
local file = io.open(config_file_path, "r")
|
||||
if file == nil then
|
||||
error("failed to read mpv config file `" .. config_file_path .. "`")
|
||||
end
|
||||
local file = io.open(config_file_path, "r")
|
||||
if file == nil then
|
||||
error("failed to read mpv config file `" .. config_file_path .. "`")
|
||||
end
|
||||
|
||||
local mpv_socket
|
||||
for line in file:lines() do
|
||||
mpv_socket = line:match("^input%-ipc%-server%s*=%s*(%g+)%s*")
|
||||
if mpv_socket then
|
||||
break
|
||||
end
|
||||
end
|
||||
local mpv_socket
|
||||
for line in file:lines() do
|
||||
mpv_socket = line:match("^input%-ipc%-server%s*=%s*(%g+)%s*")
|
||||
if mpv_socket then
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
file:close()
|
||||
file:close()
|
||||
|
||||
if not mpv_socket then
|
||||
error("input-ipc-server option does not exist in `" .. config_file_path .. "`")
|
||||
end
|
||||
if not mpv_socket then
|
||||
error("input-ipc-server option does not exist in `" .. config_file_path .. "`")
|
||||
end
|
||||
|
||||
return mpv_socket
|
||||
return mpv_socket
|
||||
end
|
||||
|
||||
local mpv_socket = find_mpv_socket(config_file_path)
|
||||
if platform == "windows" then
|
||||
mpv_socket = "\\\\.\\pipe" .. mpv_socket:gsub("/", "\\")
|
||||
mpv_socket = "\\\\.\\pipe" .. mpv_socket:gsub("/", "\\")
|
||||
end
|
||||
|
||||
local function start_websocket()
|
||||
initialised_websocket = mp.command_native_async({
|
||||
name = "subprocess",
|
||||
playback_only = false,
|
||||
capture_stdout = true,
|
||||
capture_stderr = true,
|
||||
args = {
|
||||
mpv_websocket_path,
|
||||
"-m",
|
||||
mpv_socket,
|
||||
"-w",
|
||||
"6677",
|
||||
},
|
||||
})
|
||||
initialised_websocket = mp.command_native_async({
|
||||
name = "subprocess",
|
||||
playback_only = false,
|
||||
capture_stdout = true,
|
||||
capture_stderr = true,
|
||||
args = {
|
||||
mpv_websocket_path,
|
||||
"-m",
|
||||
mpv_socket,
|
||||
"-w",
|
||||
"6677",
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
local function end_websocket()
|
||||
mp.abort_async_command(initialised_websocket)
|
||||
initialised_websocket = nil
|
||||
mp.abort_async_command(initialised_websocket)
|
||||
initialised_websocket = nil
|
||||
end
|
||||
|
||||
local function toggle_websocket()
|
||||
local paused = mp.get_property_bool("pause")
|
||||
if initialised_websocket and paused then
|
||||
end_websocket()
|
||||
elseif not initialised_websocket and not paused then
|
||||
start_websocket()
|
||||
end
|
||||
local paused = mp.get_property_bool("pause")
|
||||
if initialised_websocket and paused then
|
||||
end_websocket()
|
||||
elseif not initialised_websocket and not paused then
|
||||
start_websocket()
|
||||
end
|
||||
end
|
||||
|
||||
mp.register_script_message("togglewebsocket", toggle_websocket)
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 5435ee033fc328926fde0423051ebe5149629d0b
|
||||
Subproject commit db1fdaf40b3753fc308aa3152954e2edc491330e
|
Loading…
x
Reference in New Issue
Block a user