Closed porg closed 1 year ago
This is a very practical issue, and scripts should not significantly affect the normal use of network sharing.
Workaround: Exclusion-list or inclusion-list of filepaths for loading chapter files
This is actually not difficult to implement, but the problem with this solution is that users only realize the need to exclude paths in the script after experiencing a bad experience and conducting troubleshooting.
Make lua file access aware whether it is local or network.
Yes, we cannot achieve this, which is the real issue.
I have added a commit https://github.com/dyphire/mpv-scripts/commit/9de27403b9303ee2eff319760168d47c77b32e7f to try to improve this aspect of usage. Can you test if it would be helpful?
$duration-sidecar-open-max
(default: 6secs) then we give a dialog:Looking up the chapter file for this video took too long!
The reason for the slow loading of videos is not due to searching for chapters, but rather to the script's previous attempt to obtain a directory list. This can lead to poor performance on network shared paths.
To avoid such slowdowns you can include / exclude certain filepath(s) for chapter file lookup.
If the existing solution is not effective, I will consider it.
What fix strategy your commit follows? (Detecting local vs. remote file access?) Whether this is supposed to work on macOS? (it's Unix, but still some tools / syscalls may be different)
There will be no issues with local files, with a focus on performance on network sharing. SMB performance on the macOS platform has been consistently poor, but this issue should not be related to it.
The script previously attempted to obtain a directory list using utils.readdir
and io.open
functions, which unexpectedly took a lot of time on network sharing. The commit https://github.com/dyphire/mpv-scripts/commit/9de27403b9303ee2eff319760168d47c77b32e7f using utils.file_info
function to avoid obtaining directory lists, hoping to significantly improve the performance of network sharing.
Update: The previous commit had some minor issues and has been pushed again. Please test new commit https://github.com/dyphire/mpv-scripts/commit/467f51f31592bf22999bd216ab6f24b1e5090a1e.
✅ Commit 9de2740 fixed it really well!
A.avi.chp
to B.mkv.chp
to C.mp4.chp
via SSH on the NAS, and sporadically changed some chapter titles with nano
to be sure it really loads the latest (an no "caches" or "ghosts").mpv
reliably opened the new corresponding chapter sidecar file.
So from my side we can close this as fixed 🙂
$ ssh nas
$ cd /path/to/video-dir/
$ nano video-file-autocompletion then add .chp
create your chapters
ctrl-x → save buffer → yes
.chp
file gets visible in FinderAs expected, the problem lies in obtaining the directory list. fixed
Thanks a lot!
Reproduction
chapter-make-read.lua
into~/.config/mpv/scripts/
chapter-make-read.lua
from~/.config/mpv/scripts/
to~/.config/mpv/scripts-off/
chapter-make-read.lua
back to~/.config/mpv/scripts/
and move the video into a folder with no or only few sister files.Suspicion
video-filename.videoSuffix
the script looks for the existence of the sidecar filevideo-filename.videoSuffix.chp
Possible improvements