Thann / play-with-mpv

Chrome extension that allows you to play videos in webpages like youtube with MPV instead
https://chrome.google.com/webstore/detail/play-with-mpv/hahklcmnfgffdlchjigehabfbiigleji
The Unlicense
349 stars 80 forks source link

Cannot play magnet link with peerflix installed #27

Open Jerrk opened 4 years ago

Jerrk commented 4 years ago

playing normally through cmd with peerflix "magnetlink" --mpv works wonderfully, but in chrome right-clicking a magnet link and choosing "Play with MPV" doesn't seem to do anything. Is there any further configuration i need to do to make this work?

Thann commented 4 years ago

Try running play-with-mpv from a terminal, and see what it says when you use the extension =]

Jerrk commented 4 years ago

Sorry that this took ages to get back to, here are my error logs. I did just an hour ago in a fresh VM to make sure everything is up to date and nothing was changed within the past months.

Both peerflix "magnet-url" --mpv and their new webtorrent "magnet-url" --mpv work as normal

C:\Users\tester1>cd C:\Users\tester1\AppData\Roaming\Python\Python38\Scripts

C:\Users\tester1\AppData\Roaming\Python\Python38\Scripts>python play-with-mpv.exe
serving on localhost:7531
---------------------------------------- BELOW IS THE OUTPUT FROM RIGHTCLICKING A MAGNET LINK WITHIN CHROME AND CLICKING "PLAY WITH MPV"----------------------
Exception happened during processing of request from ('127.0.0.1', 62808)
Traceback (most recent call last):
  File "C:\Users\tester1\AppData\Local\Programs\Python\Python38-32\lib\socketserver.py", line 316, in _handle_request_noblock
    self.process_request(request, client_address)
  File "C:\Users\tester1\AppData\Local\Programs\Python\Python38-32\lib\socketserver.py", line 347, in process_request
    self.finish_request(request, client_address)
  File "C:\Users\tester1\AppData\Local\Programs\Python\Python38-32\lib\socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Users\tester1\AppData\Local\Programs\Python\Python38-32\lib\socketserver.py", line 720, in __init__
    self.handle()
  File "C:\Users\tester1\AppData\Local\Programs\Python\Python38-32\lib\http\server.py", line 427, in handle
    self.handle_one_request()
  File "C:\Users\tester1\AppData\Local\Programs\Python\Python38-32\lib\http\server.py", line 415, in handle_one_request
    method()
  File "C:\Users\tester1\AppData\Roaming\Python\Python38\site-packages\play_with_mpv.py", line 47, in do_GET
    pipe = Popen(['peerflix', '-k',  url, '--', '--force-window'] +
  File "C:\Users\tester1\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\tester1\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 1307, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
---------------------------------------- BELOW IS THE OUTPUT FROM CLICKING THE SAMPLE LINK WHICH DOES WORK.----------------------
127.0.0.1 - - [21/May/2020 18:41:57] "GET /?play_url=https://www.youtube.com/watch?v=dQw4w9WgXcQ HTTP/1.1" 200 -
Thann commented 4 years ago

FileNotFoundError This means that peerflix can't be found because its not installed in the proper location or otherwise not "on the PATH". If you open a terminal from any location you should be able to type "peerflix" and have it respond.

Jerrk commented 4 years ago

C:\Users\tester1\AppData\Roaming\npm is in my PATH and it contains peerflix, peerflix.cmd and peerflix.ps1 which i assume is correct

C:\Users\tester1>peerflix
Usage: C:\Program Files\nodejs\node.exe C:\Users\tester1\AppData\Roaming\npm\node_modules\peerflix\app.js magnet-link-or-torrent [options]

Options:
  -c, --connections  max connected peers                            [default: 100]
  -p, --port         change the http port                           [default: 8888]
  -i, --index        changed streamed file (index)
  -l, --list         list available files with corresponding index
  -t, --subtitles    load subtitles file
  -q, --quiet        be quiet
  -v, --vlc          autoplay in vlc*
  -s, --airplay      autoplay via AirPlay
  -m, --mplayer      autoplay in mplayer*
  -g, --smplayer     autoplay in smplayer*
  --mpchc            autoplay in MPC-HC player*
  --potplayer        autoplay in Potplayer*
  -k, --mpv          autoplay in mpv*
  -o, --omx          autoplay in omx**
  -w, --webplay      autoplay in webplay
  -j, --jack         autoplay in omx** using the audio jack
  -f, --path         change buffer file path
  -b, --blocklist    use the specified blocklist
  -n, --no-quit      do not quit peerflix on vlc exit
  -a, --all          select all files in the torrent
  -r, --remove       remove files on exit
  -h, --hostname     host name or IP to bind the server to
  -e, --peer         add peer by ip:port
  -x, --peer-port    set peer listening port
  -d, --not-on-top   do not float video on top
  --on-downloaded    script to call when file is 100% downloaded
  --on-listening     script to call when server goes live
  --version          prints current version

Options passed after -- will be passed to your player

  "peerflix magnet-link --vlc -- --fullscreen" will pass --fullscreen to vlc

* Autoplay can take several seconds to start since it needs to wait for the first piece
** OMX player is the default Raspbian video player

C:\Users\tester1>
Jerrk commented 4 years ago

Heres the same torrent and sample link on my main desktop

C:\Users\Jerrk\AppData\Roaming\Python\Python38\Scripts>python play-with-mpv-script.pyw
serving on localhost:7531
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 51409)
Traceback (most recent call last):
  File "C:\Python\Python38\lib\socketserver.py", line 316, in _handle_request_noblock
    self.process_request(request, client_address)
  File "C:\Python\Python38\lib\socketserver.py", line 347, in process_request
    self.finish_request(request, client_address)
  File "C:\Python\Python38\lib\socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Python\Python38\lib\socketserver.py", line 720, in __init__
    self.handle()
  File "C:\Python\Python38\lib\http\server.py", line 427, in handle
    self.handle_one_request()
  File "C:\Python\Python38\lib\http\server.py", line 415, in handle_one_request
    method()
  File "C:\Users\Jerrk\AppData\Roaming\Python\Python38\site-packages\play_with_mpv.py", line 47, in do_GET
    pipe = Popen(['peerflix', '-k',  url, '--', '--force-window'] +
  File "C:\Python\Python38\lib\subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Python\Python38\lib\subprocess.py", line 1307, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
----------------------------------------
127.0.0.1 - - [21/May/2020 20:42:53] "GET /?play_url=https://www.youtube.com/watch?v=dQw4w9WgXcQ HTTP/1.1" 200 -

Note sure why the .exe doesn't work though, it throws me this error

C:\Users\Jerrk\AppData\Roaming\Python\Python38\Scripts>python play-with-mpv.exe
  File "play-with-mpv.exe", line 1
SyntaxError: Non-UTF-8 code starting with '\x90' in file play-with-mpv.exe on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

C:\Users\Jerrk\AppData\Roaming\Python\Python38\Scripts>
ghost commented 4 years ago

Hi! On my linux system I have a related problem: magnet links do not work, the output of the play-with-mpv-script.pyw shows that all the peer addresses are choked. Any idea of the reason? Thanks for the great script by the way!

miyagui commented 3 years ago

Hi! On my linux system I have a related problem: magnet links do not work, the output of the play-with-mpv-script.pyw shows that all the peer addresses are choked. Any idea of the reason? Thanks for the great script by the way!

Exactly the same problem. It gets stuck. I tested it through peerflix directly and it works flawlessly.

Could the problem have something to do with the play_url variable? Maybe the parsing step is corrupting the raw magnet link?