Comments (4)
I made changes so that the script would automatically work for both mpv in portable mode on windows and for mpv-android since this is what I wanted to use it for. I don't know if it works on linux or the normal mpv mode on windows.
The changes I made are as follows:
thumbs_dir = ON_WINDOWS and "%APPDATA%\\mpv\\gallery-thumbs-dir" or "~/.cache/thumbnails/mpv-gallery/",
to
thumbs_dir = mp.command_native({ "expand-path", "~~/thumbnails" }),
and
if ON_WINDOWS then
thumbs_dir = string.gsub(opts.thumbs_dir, "^%%APPDATA%%", os.getenv("APPDATA") or "%APPDATA%")
else
thumbs_dir = string.gsub(opts.thumbs_dir, "^~", os.getenv("HOME") or "~")
end
local res = utils.file_info(thumbs_dir)
if not res or not res.is_dir then
if opts.mkdir_thumbs then
local args = ON_WINDOWS and { "mkdir", thumbs_dir } or { "mkdir", "-p", thumbs_dir }
utils.subprocess({ args = args, playback_only = false })
else
msg.error(string.format("Thumbnail directory \"%s\" does not exist", thumbs_dir))
end
end
to
thumbs_dir = opts.thumbs_dir
local res = utils.file_info(thumbs_dir)
if not res or not res.is_dir then
if opts.mkdir_thumbs then
if ON_WINDOWS then
os.execute("mkdir " .. thumbs_dir:gsub("/", "\\"))
else
local args = { "mkdir", "-p", thumbs_dir }
utils.subprocess({ args = args, playback_only = false })
end
else
msg.error(string.format("Thumbnail directory \"%s\" does not exist", thumbs_dir))
end
end
The use of expand-path
was the key.
from mpv-gallery-view.
I don't know if it's possible currently, but we might be able to use expand-path
on the configured thumbs dir, such that it can be defined relative to the mpv config location.
I won't be able to check it in the near future though, so either PRs welcome or ping me again in ~2 weeks
from mpv-gallery-view.
Managed to solve it on my own. Thanks for the hint!
from mpv-gallery-view.
Could you share your solution?
from mpv-gallery-view.
Related Issues (20)
- Draggable scroll bar HOT 2
- save contact sheet to a file HOT 3
- Appearance issue with osd-align-x=center
- Folder gallery on file open with mpv HOT 1
- Show embedded thumbnails if available
- OSC no longer visible when using playlist-view HOT 1
- Broken demo preview
- Option to store thumbs in the file folder ?
- Package this script so it can be run out of a directory inside mpv's script folder HOT 4
- Add it in mplug script directory
- thumbnails not apeairing :( HOT 4
- Thumbnails not being genarated HOT 2
- Show position of file in gallery as number X out of Y
- Better thumbnail management HOT 2
- mpv bug is fixed HOT 1
- New youtube thumbnail address
- Choking on filenames starting with "-"
- Feature request: restoring flagged state
- Add vf=libplacebo to tonemap HDR
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mpv-gallery-view.