occivink / mpv-image-viewer

Configuration, scripts and tips for using mpv as an image viewer
The Unlicense
284 stars 23 forks source link

detect-image.lua not detecting? #18

Closed bearcatsandor closed 3 years ago

bearcatsandor commented 3 years ago

This is my first attempt setting up something like this in mpv, so it's probably me. I can't get the autodectection of images working. If I run mpv with 'mpv -profile image ~/Pictures/screenshots/' it works as I'd expect, but 'mpv ~/Pictures/screenshots' just plays through them like always. I'm not sure if the directory names matter but here's my tree: ~/.config/mpv: config input.conf ravu-lite-r3.hook

script-opts: detect_image.conf minimap.conf mpv_thumbnail_script.conf status_line.conf image_positioning.conf ruler.conf

scripts: mpv_image_viewer mpv_thumbnail_script_client_osc.lua mpv_thumbnail_script_server.lua

scripts/mpv_image_viewer: detect-image.lua equalizer.lua freeze-window.lua image-positioning.lua minimap.lua ruler.lua status-line.lua

In detect-image.lua I've uncommented the examples as they do what I want for now, or would if they autoloaded. Where should the configs be placed?

Thank you

bearcatsandor commented 3 years ago

... and I figured it out . In order to have scripts in their own subdirs, each subdir needs a 'main' function.

occivink commented 3 years ago

Ah, I didn't know about that. What exactly do you mean about needing a main?

bearcatsandor commented 3 years ago

I had the scripts for mpv-image-viewer in its own subdirectory for clearer organization, and they weren't read. See https://mpv.io/manual/stable/#script-location When I put them all under scripts/ mpv loads them, but my terminal reports:

mpv ~/Pictures/screenshots/
Cannot find main.* for any supported scripting backend in: /home/moonwind/.config/mpv/scripts/mpv_image_viewer
Cannot find main.* for any supported scripting backend in: /home/moonwind/.config/mpv/scripts/%USERPROFILE%\Pictures\mpv
Cannot find main.* for any supported scripting backend in: /home/moonwind/.config/mpv/scripts/mpv-gallery-view

I've no idea where that second warning is coming from, as rg Pictures /home/moonwind/.config/mpv/scripts/ returns null. I'm using mpv 0.33.1 and lua 5.1.5

eugenesvk commented 1 year ago

FYI I've moved all scripts to a single folder precisely for better organization, otherwise just load everything from main.lua, though you'd also need to add a few path tweaks in the scripts themselves to be able to find config files You can check it here https://github.com/eugenesvk/mpv-image-viewer/tree/single_folder