Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script doesn't work on Windows (without some workaround) #27

Open
floppyD opened this issue Jan 8, 2021 · 12 comments
Open

Script doesn't work on Windows (without some workaround) #27

floppyD opened this issue Jan 8, 2021 · 12 comments

Comments

@floppyD
Copy link

floppyD commented Jan 8, 2021

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".

@po5
Copy link
Owner

po5 commented Jan 8, 2021

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.

@floppyD
Copy link
Author

floppyD commented Jan 8, 2021

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.

@bitsper2nd
Copy link

bitsper2nd commented Jan 22, 2021

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.

@floppyD
Copy link
Author

floppyD commented Jan 22, 2021

@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

@bitsper2nd
Copy link

Thanks for the quick reply. Sadly the script doesn't seem to be working on mpv.net, which is what I am using.

@po5
Copy link
Owner

po5 commented Jan 23, 2021

@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.

@bitsper2nd
Copy link

@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.

@ghost
Copy link

ghost commented Jul 16, 2022

@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?

@bitsper2nd
Copy link

Yes. You should use the python from the website, not the store.

@dextruct0r
Copy link

dextruct0r commented Oct 6, 2022

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.

  1. My mpv it's from sourceforge builds (https://sourceforge.net/projects/mpv-player-windows/files/64bit/)

  2. Extract it to your desired folder. (Ex: C:\Softwares\mpv)

  3. I use "portable_config" folder but it should work with other locations (Ex: C:\Softwares\mpv\portable_config)

  4. Clone the latest master available ("Code" > "Download ZIP" or other method that you want)

  5. Extract them according to the README on the scripts folder (Ex: C:\Softwares\mpv\portable_config\scripts)

  6. Create the folder "script-opts" on your config folder (Ex: C:\Softwares\mpv\portable_config\script-opts)

  7. Create a "sponsorblock.conf" inside the "script-opts" folder from the latest step

  8. 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)

  9. Put the direcrory of your Python path "python_path=C:\Users\YOUR_USER_NAME_HERE\AppData\Local\Programs\Python\Python310\python.exe"

  10. Thanks @floppyD for the tips and Profit!

@KAGEYAM4
Copy link

KAGEYAM4 commented Oct 7, 2022

@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.

@vt-idiot
Copy link

vt-idiot commented Jul 3, 2023

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
image

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

No branches or pull requests

6 participants