When opening mpv version 0.32, the following error is generated:
sponsorblock_legacy: stack traceback:
sponsorblock_legacy: [C]: in function 'require'
sponsorblock_legacy: /home/marty/.config/mpv/scripts/sponsorblock_legacy.lua:2: in main chunk
sponsorblock_legacy: [C]: in ?
sponsorblock_legacy: [C]: in ?
sponsorblock_legacy: Lua error: /home/marty/.config/mpv/scripts/sponsorblock_legacy.lua:2: module 'sponsorblock/main' not found:
sponsorblock_legacy: no field package.preload['sponsorblock/main']
sponsorblock_legacy: no file '/usr/share/lua/5.2/sponsorblock/main.lua'
sponsorblock_legacy: no file '/usr/share/lua/5.2/sponsorblock/main/init.lua'
sponsorblock_legacy: no file '/usr/lib/lua/5.2/sponsorblock/main.lua'
sponsorblock_legacy: no file '/usr/lib/lua/5.2/sponsorblock/main/init.lua'
sponsorblock_legacy: no file './sponsorblock/main.lua'
sponsorblock_legacy: no file '/usr/lib/lua/5.2/sponsorblock/main.so'
sponsorblock_legacy: no file '/usr/lib/lua/5.2/loadall.so'
sponsorblock_legacy: no file './sponsorblock/main.so'
This looks like ./sponsorblock/main.lua could not be found, thus not required correctly. The folder structure in scripts looks as follows
As far as I know, this should be the correct directory structure.
I am running mpv on linux.
It appears that the root folder for lua scripts is set to whatever directory mpv is called from, which means it always attempts to source ./sponsorblock/main.lua from wherever it is called.
Feel free to ignore this report as it only affects the legacy workaround anyways, and for the time being either:
aliasing mpv to be called from the scripts directory or
putting the sponsorblock script into one of the absolute paths looked for by lua work.
But I struggled with this for a little while and thought it worth highlighting.
Anyways, thank you so much for the work of integrating sponsorblock with mpv -- when using one of the workarounds, it works like a charm!
Edit:
Actually, just a quick edit -- changing the legacy script to substitute its package path to the one that the sponsorblock_legacy.lua file resides in also works
(though it's a bit hacky, and probably only works with unix directories):
if mp.get_script_directory == nil then
local scriptpath = debug.getinfo(1).short_src:match('.*/')
local originalpath = package.path
package.path = scriptpath .. "?.lua"
require 'sponsorblock/main'
package.path = originalpath
end
When opening mpv version 0.32, the following error is generated:
This looks like
./sponsorblock/main.lua
could not be found, thus not required correctly. The folder structure in scripts looks as followsAs far as I know, this should be the correct directory structure. I am running mpv on linux. It appears that the root folder for lua scripts is set to whatever directory mpv is called from, which means it always attempts to source
./sponsorblock/main.lua
from wherever it is called.Feel free to ignore this report as it only affects the legacy workaround anyways, and for the time being either:
But I struggled with this for a little while and thought it worth highlighting. Anyways, thank you so much for the work of integrating sponsorblock with mpv -- when using one of the workarounds, it works like a charm!
Edit:
Actually, just a quick edit -- changing the legacy script to substitute its package path to the one that the
sponsorblock_legacy.lua
file resides in also works (though it's a bit hacky, and probably only works with unix directories):