mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
26.65k stars 2.83k forks source link

scripts loading twice when mpv folder in appdata #14438

Open Obegg opened 3 days ago

Obegg commented 3 days ago

mpv Information

mpv v0.38.0-556-g95ac3222 Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
 built on Jun 25 2024 04:06:53
libplacebo version: v7.349.0 (v7.349.0-rc1-3-g1fd3c7b-dirty)
FFmpeg version: N-116015-g23531c977
FFmpeg library versions:
   libavcodec      61.8.100
   libavdevice     61.2.100
   libavfilter     10.2.102
   libavformat     61.4.100
   libavutil       59.26.100
   libswresample   5.2.100
   libswscale      8.2.100

Other Information

Reproduction Steps

download mpv extract to %appdata% rename folder to mpv create scripts folder create a new file inside scripts folder (use anything other than .lua) open mpv

Expected Behavior

scripts load once

Actual Behavior

scripts are loaded twice

[   0.017][e][cplayer] Can't load unknown script: C:/Users/Test/AppData/Roaming/mpv/scripts/only1script.txt
[   0.017][e][cplayer] Can't load unknown script: C:\Users\Test\AppData\Roaming/mpv/scripts/only1script.txt

Log File

dups.log

Sample Files

No response

I carefully read all instruction and confirm that I did the following:

Obegg commented 3 days ago

how I found this bug: I have a script that does ALT+TAB and when I placed mpv folder in %appdata% it would do it twice,

log file also shows that not only scripts are loaded twice.

hooke007 commented 3 days ago

https://mpv.io/manual/master/#files-on-windows

Config files located in the same directory as mpv.exe are loaded with lower priority. Some config files are loaded only once, which means that e.g. of 2 input.conf files located in two config directories, only the one from the directory with higher priority will be loaded.

A third config directory with the lowest priority is the directory named mpv in the same directory as mpv.exe. This used to be the directory with the highest priority, but is now discouraged to use and might be removed in the future.

Obegg commented 3 days ago

I am aware of the fact that mpv searches for a few directories (as can easily be observed in the log file), but I don't think we are on the same page here, I'm talking about the fact that mpv executes the same script twice, even though there's only one directory of mpv and that's in %appdata%.

hooke007 commented 3 days ago

mpv will search for the /script near mpv.exe and /script in appdata.

Obegg commented 3 days ago

Two conf dirs in your case.

I'll be honest, I am quite confused, is it possible we have a misunderstanding?

What I'm explaining in this issue is that I have one instance of mpv installed, which is in %appdata%, I also have a one script that does ALT+TAB, the result of which is mpv executes this script twice.

mpv will search for the /script near mpv.exe and /script in appdata.

So because mpv is in the same folder that it searches for (%appdata%) - it loads the same scripts twice? Isn't it quite flawed?

hooke007 commented 3 days ago

There is no reason to install a software in its conf dir. I do not see a problem here. If you move mpv.exe to anywhere else and keep the same script both in two /script , it will be loaded "twice" too.