mpv_sponsorblock
mpv_sponsorblock copied to clipboard
Script doesn't work on Windows (without some workaround)
I have both Python 2.7.18 x86 and 3.8.7 installed, both set to add to PATH on install (it's opt-in). The issue is that "python" is set to 2.7 by default, and python3 is not set to anything (I reinstalled both to double check).
The solution I found was simply replacing "python" or "python3"
on line 11 with just "py"
.
There's no universal solution to this, Windows installations don't all have python3
or the py
launcher.
Other than checking available programs in path, which I'd rather not do.
Don't edit the script, use the python_path
script option in a .conf file.
This lets you update the script without having to mess with source code every time.
Thanks, that's better. I think you should include something on readme to make Windows users aware of this, since the first time I tried it I simply assumed it was broken and was about to move on before I noticed it was an easy to solve issue.
Thanks, that's better. I think you should include something on readme to make Windows users aware of this, since the first time I tried it I simply assumed it was broken and was about to move on before I noticed it was an easy to solve issue.
How did you got this to work? I am using a portable version of Python. It is in my System PATH. Still the script is not working for me on Windows.
@bitsper2nd Make a folder in mpv's directory named "script-opts" then place a file called "sponsorblock.conf" inside it, in that file put the directory of python's executable after "python_path="
Ex:
python_path=C:\Users\User\AppData\Local\Programs\Python\Python38\python.exe
Thanks for the quick reply. Sadly the script doesn't seem to be working on mpv.net, which is what I am using.
@bitsper2nd PRs for support on 3rd party frontends are welcome, but as I don't use them myself I won't be putting my own time into it.
@po5 don't worry about it. I suspected as much. Could be a mpv.net thing or the libmpv version used is older. That said, mpv.net is based on shinchiro's builds. So I am hopeful in that with future updates, more will be compatible.
@floppyD hey I'm having a bit of trouble setting this up. It is working for you still? also is there a difference if my python is from the windows store?
Yes. You should use the python from the website, not the store.
My Windows mpv installation was running fine until some point early this year until it broke, but since I use Voidlinux on my other machines no hurry. So I took some time to fix it today, and finally worked! Lets go to the steps.
-
My mpv it's from sourceforge builds (https://sourceforge.net/projects/mpv-player-windows/files/64bit/)
-
Extract it to your desired folder. (Ex: C:\Softwares\mpv)
-
I use "portable_config" folder but it should work with other locations (Ex: C:\Softwares\mpv\portable_config)
-
Clone the latest master available ("Code" > "Download ZIP" or other method that you want)
-
Extract them according to the README on the scripts folder (Ex: C:\Softwares\mpv\portable_config\scripts)
-
Create the folder "script-opts" on your config folder (Ex: C:\Softwares\mpv\portable_config\script-opts)
-
Create a "sponsorblock.conf" inside the "script-opts" folder from the latest step
-
I Tested with Python 3.8.5 (Python38-32 Folder) and didn't work, so I downloaded an installed the latest version at the time (https://www.python.org/ftp/python/3.10.7/python-3.10.7-amd64.exe)
-
Put the direcrory of your Python path "python_path=C:\Users\YOUR_USER_NAME_HERE\AppData\Local\Programs\Python\Python310\python.exe"
-
Thanks @floppyD for the tips and Profit!
@po5 @floppyD please update the readme , i would do but i still don't know, was fully going to stop using it as it was not working, then found this and manually made the config and added the path to python and it working now.
po5 don't worry about it. I suspected as much. Could be a mpv.net thing or the libmpv version used is older. That said, mpv.net is based on shinchiro's builds. So I am hopeful in that with future updates, more will be compatible.
@bitsper2nd : it does work just fine for me in mpv.net! I don't know if that was always the case, but other than having to change the skip_categories
to cover more than just "sponsor"
it worked without a fuss. You can even add it to mpv.net's menu as well by editing its input.conf (%APPDATA%\mpv.net\input.conf
), excerpt below.
...
_ script-message mpv.net show-history #menu: Tools > Show History
...
CTRL+d cycle-values hwdec auto no #menu: Tools > Toggle Hardware Decoding
_ script-message mpv.net show-setup-dialog #menu: Tools > Setup...
g script-binding sponsorblock/set_segment #menu: SponsorBlock > Set Segment Boundaries
G script-binding sponsorblock/submit_segment #menu: SponsorBlock > Submit Segment
h script-binding sponsorblock/upvote_segment #menu: SponsorBlock > Upvote Previous Segment
H script-binding sponsorblock/downvote_segment #menu: SponsorBlock > Downvote Previous Segment
_ script-message mpv.net shell-execute https://mpv.io #menu: Help > Website mpv
_ script-message mpv.net shell-execute https://github.com/stax76/mpv.net #menu: Help > Website mpv.net
_ ignore #menu: Help > -
_ script-message mpv.net shell-execute https://mpv.io/manual/stable/ #menu: Help > Manual mpv
_ script-message mpv.net shell-execute https://github.com/stax76/mpv.net/blob/master/docs/Manual.md #menu: Help > Manual mpv.net
_ ignore #menu: Help > -
_ script-message mpv.net update-check #menu: Help > Check for Updates
_ script-message mpv.net show-about #menu: Help > About mpv.net
_ ignore #menu: -
Esc quit #menu: Exit
Q quit-watch-later #menu: Exit Watch Later
...
If you set the bound keys to _
instead of the default ones like I did above, you can use them without keybinds, ie. in the menu only.
I did have to unbind something that was already bound to one of the defaults, and I changed the second for good measure just to be safe (and because it made more sense to me on CTRL+d = hwdec, d = deinterlace).
h script-message mpv.net show-history #menu: Tools > Show History
Ctrl+h cycle-values hwdec auto no #menu: Tools > Toggle Hardware Decoding
Tada