Skip to content

enable loading from global scripts dir#66

Open
robertgzr wants to merge 1 commit intopo5:masterfrom
robertgzr:master
Open

enable loading from global scripts dir#66
robertgzr wants to merge 1 commit intopo5:masterfrom
robertgzr:master

Conversation

@robertgzr
Copy link
Copy Markdown

the scripts_dir detection logic uses mp.find_config_file("scripts") which
returns $XDG_CONFIG_HOME/mpv/scripts even if the plugin is installed globally
under /etc/mpv/scripts.

fix this by using mp.get_script_directory(), which requires the install the
plugin in a script directory, but that is recommended anyway for plugins like
this one: https://mpv.io/manual/master/#script-location

the scripts_dir detection logic uses `mp.find_config_file("scripts")` which
returns `$XDG_CONFIG_HOME/mpv/scripts` even if the plugin is installed globally
under `/etc/mpv/scripts`.

fix this by using `mp.get_script_directory()`, which requires the install the
plugin in a `script directory`, but that is recommended anyway for plugins like
this one: https://mpv.io/manual/master/#script-location

Signed-off-by: Robert Günzler <r@gnzler.io>
@robertgzr
Copy link
Copy Markdown
Author

i guess this kind of depends on #17

@po5
Copy link
Copy Markdown
Owner

po5 commented May 5, 2023

Wouldn't mp.find_config_file("scripts/sponsorblock_shared") work as well?
I'd like to keep support for mpv <0.33.0 if it doesn't add complexity.

@robertgzr
Copy link
Copy Markdown
Author

yeah that seems to work as well...

@nicoonoclaste
Copy link
Copy Markdown

I'd like to keep support for mpv <0.33.0 if it doesn't add complexity.

Out of curiosity, is there a particular reason? Glancing through Repology, mpv 0.33 (or later) seems to be in all currently-supported releases of all major software distributions.

I'm asking because it adds some complexity downstream instead, both for users who manually clone the repo and copy/symlink files into place, and for distro packagers; granted, IDK of anyone packaging mpv scripts outside of us in nixpkgs.

nicoonoclaste added a commit to nicoonoclaste/mpv_sponsorblock that referenced this pull request May 1, 2024
This is the most platform-independent way, and fixes things
for users who have a global scripts directory. (see po5#66)

Closes po5#17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants