po5 / mpv_sponsorblock

mpv script to skip sponsored segments of YouTube videos
GNU General Public License v3.0
531 stars 29 forks source link

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

Open lainiwa opened 3 years ago

lainiwa commented 3 years ago

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?

lucy commented 2 years ago

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.