Open scarlion1 opened 2 years ago
I've never programmed with mpv or lua before, but I feel like using mp.get_property("path")
could be used. However when I try to use it the value is always "nil" I guess because the script is running before the video is loaded?
Yay I figured out something! Just made some changes to function Thumbnailer:get_thumbnail_template()
in mpv_thumbnail_script_client_osc.lua
Basically added local filedir, filename = utils.split_path(file_path)
after the first line and added two join_paths()
in place of the original.
Now if I set cache_directory=.thumbnails
then the thumbnails get created in <the directory the video is in>/.thumbnails/<file_key>/
$ diff mpv_thumbnail_script_client_osc.lua mpv_thumbnail_script_client_osc.lua.orig
919,920d918
< local filedir, filename = utils.split_path(file_path)
<
938,940c936
< -- local thumbnail_directory = join_paths(self.cache_directory, file_key)
< local thumbnail_directory_base = join_paths(filedir, self.cache_directory)
< local thumbnail_directory = join_paths(thumbnail_directory_base, file_key)
---
> local thumbnail_directory = join_paths(self.cache_directory, file_key)
$
It would be nice to determine it automatically: if cache_directory
isn't an absolute path, then consider it relative to the file being played.
On *nix, we can simply check for a /
as first character, I don't know how it can be detected on windows.
Instead of having all the thumbnails saved into one directory, is it possible to save them in a ".thumbnails" subdirectory in the same directory the video is loaded from? Either with the config file or by editing the script code? I tried
cache_directory=./.thumbnails
but it puts the ".thumbnails" in my home directory. Thanks