mpv
mpv copied to clipboard
Watch history file stored in current directory when running with `--no-config`
mpv Information
mpv v0.40.0 Copyright © 2000-2025 mpv/MPlayer/mplayer2 projects
libplacebo version: v7.349.0
FFmpeg version: 7.1.1-1+b1
FFmpeg library versions:
libavcodec 61.19.101
libavdevice 61.3.100
libavfilter 10.4.100
libavformat 61.7.100
libavutil 59.39.100
libswresample 5.3.100
libswscale 8.3.100
Other Information
- Linux version: Debian GNU/Linux unstable (sid)
- Kernel Version: Linux host 6.12.27-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.27-1 (2025-05-06) x86_64 GNU/Linux
- GPU Model:
- Mesa/GPU Driver Version:
- Window Manager and Version:
- Source of mpv: Debian package
- Latest known working version:
- Issue started after the following happened:
Reproduction Steps
Run
mpv --no-config --save-watch-history 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
Expected Behavior
Watch history file should be stored in ~~state/watch_history.jsonl as documented in the man page.
Actual Behavior
Watch history file is stored the current directory.
Log File
Sample Files
No response
I carefully read all instruction and confirm that I did the following:
- [x] I tested with the latest mpv version to validate that the issue is not already fixed.
- [x] I provided all required information including system and mpv version.
- [x] I produced the log file with the exact same set of files, parameters, and conditions used in "Reproduction Steps", with the addition of
--log-file=output.txt. - [x] I produced the log file while the behaviors described in "Actual Behavior" were actively observed.
- [x] I attached the full, untruncated log file.
- [x] I attached the backtrace in the case of a crash.
It's not a bug https://github.com/mpv-player/mpv/blob/817372ac96b19ec7228e0ea415598bc629a10431/DOCS/man/mpv.rst?plain=1#L567-L579
We should have --no-state and make --no-config do what it actually should do, instead of bundling everything there.
Either way, as it currently stands, --no-config should not save any history. So it is indeed a bug.
This is indeed a bug, our code should be handling "" to mean "don't save" and not "cwd".
We should have --no-state and make --no-config do what it actually should do, instead of bundling everything there.
related: 084a8782e39a80291817593c50f68633a2ab8ef0
Either way, as it currently stands, --no-config should not save any history. So it is indeed a bug.
Expected Behavior Watch history file should be stored in ~~state/watch_history.jsonl as documented in the man page.
But the question is, OP want the history instead of not saving.
Well there's no simple fix here.
https://github.com/mpv-player/mpv/blob/1d1535ff9124fdeb3c81a2f089551e2cc8404613/options/path.c#L208-L215
Would have to change this part to return NULL when p is NULL.
But then someone needs to check every caller of mp_get_user_path and make sure NULL is handled, as well as potential other side effects.
In mpv-x86_64-20250727-git-73c2118 using save-watch-history creates ~~state folder in the same folder with media file or in the folder where mpv.exe is located.
Previous version mpv-x86_64-20250720-git-440f35a is not affected.
UPD: fixed in mpv-x86_64-20250810-git-01b7edc
Sounds like a different bug, please open a new issue.
That's caused by 137d5374bd45a857e12b8cd76735d34cf0294625. #16583 is meant to correct that but it actually doesn't work for this particular case so I will look at it some more. Different bug either way.
Edit: should work now on that PR.