mpv_sponsorblock icon indicating copy to clipboard operation
mpv_sponsorblock copied to clipboard

Consider setting `scripts_dir` path relative to `sponsorblock.lua`'s path?

Open lainiwa opened this issue 3 years ago • 1 comments

I am using a following mpv config layout:

~/.config/mpv/
├── input.conf
└── scripts/
   ├── modules.lua    <-- loads scripts from sub-folders
   ├── mpv_sponsorblock/
   │  ├── LICENSE
   │  ├── README.md
   │  ├── sponsorblock.lua
   │  └── sponsorblock_shared/...
   ├── ...
   └── ...

It however doesn't work with mpv_sponsorblock, as sponsorblock.lua is making assumption it was unpacked into the root of scripts/ folder.

Can scripts_dir variable be set to something like

scripts_dir = debug.getinfo(1).source:match("@?(.*/)")

so that it would be a bit more flexible?

lainiwa avatar Apr 27 '21 12:04 lainiwa

Would be better to rename the script to main.lua, move the contents of sponsorblock_shared to the root of the repo and use mp.get_script_directory().

Like this: https://github.com/lucy/mpv_sponsorblock/commit/e0206e132b12f1bb0143afb72325a4d014a40be8

That way you can just clone the repo into your mpv scripts directory.

lucy avatar Dec 02 '21 01:12 lucy