(使用的是mpv-lazy项目)
如题,我问了gpt,他给的两个方案一个lua脚本一个conf文件均失效……
现在的状态使是没有用conf,用了lua脚本,但仍然多个实例同时运行
附:
解决方案1
conf文件添加一行
single-instance=yes
解决方案2
新建一lua脚本至 '~\portable_config\scripts' 目录下
local mp = require 'mp'
function focus_existing_instance()
local running = mp.command_native({"get_property", "pid"})
if running then
mp.command_native({"run", "wmctrl", "-a", "mpv"})
os.exit()
end
end
mp.register_event("file-loaded", focus_existing_instance)
但经过测试,两种方法均失效,求问原因。
附:
conf文件内容
### https://github.com/hooke007/MPV_lazy/blob/main/portable_config/mpv.conf
input-conf = "~~/input_uosc.conf"
include = "~~/profiles.conf"
include = "~~/script-opts.conf"
use-filedir-conf = yes
#log-file = "~~desktop/mpv-lazy.log"
########
# 基础 #
########
#vo = gpu-next
#gpu-context = winvk
#d3d11-exclusive-fs = yes
#d3d11-flip = no
#single-instance=yes
hwdec = auto-copy
hwdec-codecs = h264,hevc,vp8,vp9,av1,prores
#d3d11-adapter = "NVIDIA GeForce RTX 2070 Super"
#vulkan-device = "NVIDIA GeForce RTX 2070 Super"
########
# 功能 #
########
idle = yes
#input-ipc-server = mpvpipe
input-builtin-bindings = no
pause = no
hr-seek-framedrop = no
save-position-on-quit = yes
watch-later-options = start,vid,aid,sid
loop-playlist = yes
keep-open = yes
#ontop = yes
#border = no
autofit-smaller = 40%x40%
keepaspect-window = no
auto-window-resize = yes
hidpi-window-scale = no
demuxer-max-bytes = 1024MiB
icc-cache-dir = "~~/_cache/icc"
gpu-shader-cache-dir = "~~/_cache/shader"
watch-later-directory = "~~/_cache/watch_later"
#######
# OSD #
#######
osd-on-seek = msg
#osd-blur = 1
osd-bar-w = 100
osd-bar-h = 1.5
osd-bar-align-y = -1
osd-color = "#672168"
osd-border-color = "#FFFFFF"
osd-border-size = 1
osd-font-size = 40
osd-fractions = yes
osd-playing-msg = "${filename}"
osd-duration = 2000
osd-playing-msg-duration = 3000
########
# 音频 #
########
ao = wasapi
#audio-device = "wasapi/{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}"
audio-exclusive = no
volume = 100
volume-max = 120
audio-channels = stereo
alang = chs,sc,zh,chi,zho
audio-file-auto = fuzzy
audio-pitch-correction = yes
########
# 视频 #
########
#icc-profile-auto = yes
#target-prim = display-p3
video-sync = display-resample
video-sync-max-video-change = 5
interpolation = yes
tscale = linear
cscale = bilinear
scale = spline36
dscale = bicubic
#sigmoid-upscaling = yes
#correct-downscaling = yes
#dither-depth = 10
#dither = error-diffusion
#deband = yes
#tone-mapping = bt.2390
tone-mapping-mode = hybrid
gamut-mapping-mode = clip
####################
# 脚本 滤镜 着色器 #
####################
osc = no
#ytdl-raw-options-append = cookies-from-browser=edge
#load-scripts = no
glsl-shaders-append = "~~/shaders/AMD_FSR_EASU_rgb.glsl"
########
# 字幕 #
########
sub-auto = fuzzy
sub-file-paths = sub;subtitles
slang = chs,sc,zh,chi,zho
#blend-subtitles = video
sub-font = "LXGW WenKai Mono"
sub-font-size = 44
#sub-scale-with-window = no
sub-border-size = 4
sub-blur = 1
sub-color = "#FFD766"
#sub-back-color = "#641C1C1C"
#sub-shadow-offset = 2
sub-use-margins = yes
#sub-ass-override = force
#sub-ass-scale-with-window = yes
sub-ass-force-margins = yes
#sub-ass-force-style = Fontname=LXGW WenKai Mono
#stretch-image-subs-to-screen = yes
#image-subs-video-resolution = yes
########
# 截图 #
########
screenshot-format = png
screenshot-jpeg-quality = 100
#screenshot-jpeg-source-chroma = no
screenshot-webp-lossless = yes
screenshot-webp-compression = 0
screenshot-jxl-distance = 0
screenshot-tag-colorspace = no
screenshot-high-bit-depth = no
screenshot-template = "~~desktop/MPV-%P-N%n"