mrxdst / webtorrent-mpv-hook

Adds a hook that allows mpv to stream torrents
The Unlicense
132 stars 7 forks source link

Failed to load torrent #17

Closed metapea closed 1 week ago

metapea commented 2 years ago
[input] Command 'loop-file=inf' not found.
[input] Command was defined at mpv/mpv/input.conf
2.
Can't load unknown script: mpv/mpv/scripts/win-he
per.vbs
Cannot find main.* for any supported scripting backend in:(x8
)/mpv/mpv/scripts/modules
[assrt]
[assrt] stack traceback:
[assrt]         [string "/mpv/mpv/scripts..."]:26:
in main chunk
[assrt]         [C]: at 0x013f6032f0
[assrt]         [C]: at 0x013f601570
[assrt] Lua error: [string "/mpv/mpv/scripts..."]:
6: module 'modules.AssFormat' not found:
[assrt]         no field package.preload['modules.AssFormat']
[assrt]         no file ':mpv/mpv/scripts/modules\A
sFormat.lua'
[assrt]         no file '\mpv\lua\modules\AssForma
.lua'
[assrt]         no file '\mpv\lua\modules\AssForma
\init.lua'
[assrt]         no file '\mpv\modules\AssFormat.dl
'
[assrt]         no file 'mpv\loadall.dll'
[assrt]         no file '\mpv\modules.dll'
[assrt]         no file '\mpv\loadall.dll'
[file] Cannot open file 'magnet:': Invalid argument
Failed to open
[webtorrent] Running WebTorrent hook
[webtorrent] Failed to get node script path

I also got the same error with: Failed to recognize file format. added when trying to load a torrent link from archive.org

mrxdst commented 2 years ago

[webtorrent] Failed to get node script path

This error can occur if the node command is not available in your path. My best guess is that the command is called nodejs on your system.

I have updated the hook with a more descriptive error.
And also added a script option to specify the command to use.

Version 1.3.3

In mpv/script-opts/webtorrent.conf, add the following:

node_path=nodejs
metapea commented 2 years ago

I've changed node_path: 'node' to node_path=nodejs and node_path: 'nodejs', but i still got an error:

[input] Command 'loop-file=inf' not found.
[input] Command was defined at /mpv/mpv/input.conf:
2.
Can't load unknown script: /mpv/mpv/scripts/win-hel
per.vbs
Cannot find main.* for any supported scripting backend in: /mpv/mpv/scripts/modules
[assrt]
[assrt] stack traceback:
[assrt]         [string "/mpv/mpv/scripts..."]:26:
in main chunk
[assrt]         [C]: at 0x0140083340
[assrt]         [C]: at 0x01400815c0
[assrt] Lua error: [string "/mpv/mpv/scripts..."]:2
6: module 'modules.AssFormat' not found:
[assrt]         no field package.preload['modules.AssFormat']
[assrt]         no file ':mpv/mpv/scripts/modules\As
sFormat.lua'
[assrt]         no file '\mpv\lua\modules\AssFormat
.lua'
[assrt]         no file '\mpv\lua\modules\AssFormat
\init.lua'
[assrt]         no file '\mpv\modules\AssFormat.dll
'
[assrt]         no file 'mpv\loadall.dll'
[assrt]         no file 'mpv\modules.dll'
[assrt]         no file '\mpv\loadall.dll'
[file] Cannot open file 'magnet:': Invalid argument
Failed to open magnet:
[webtorrent] Running WebTorrent hook
[webtorrent] Failed to get node script path. Possible causes are "nodejs" not av
ailable in path or incorrect symlink.

Exiting... (Errors when loading file)
'dn' is not recognized as an internal or external command,
operable program or batch file.
'tr' is not recognized as an internal or external command,
operable program or batch file.
'tr' is not recognized as an internal or external command,
operable program or batch file.
'tr' is not recognized as an internal or external command,
operable program or batch file.
'tr' is not recognized as an internal or external command,
operable program or batch file.
'tr' is not recognized as an internal or external command,
operable program or batch file.

also there's no .conf, i'm using windows

mrxdst commented 2 years ago

OK. so my initial assessment was wrong. On windows it should be called node.

Please post the output from running the following commands in cmd (not powershell):

  1. node --version
  2. npm list -g webtorrent-mpv-hook
  3. dir %APPDATA%\mpv\scripts

Also when running mpv make sure to put the magnet link withing "quotation marks" if you are not already doing that.

metapea commented 2 years ago

node --version: v16.14.0

npm list -g webtorrent-mpv-hook: -- webtorrent-mpv-hook@1.3.3

dir:

03/22/2022  06:57 PM    <DIR>          .
03/22/2022  06:57 PM    <DIR>          ..
06/30/2020  10:05 AM            14,720 assrt.lua
06/30/2020  10:05 AM    <DIR>          modules
05/09/2020  08:25 AM            70,699 webm.lua
02/28/2022  04:20 PM    <SYMLINK>      webtorrent.js [..\..\..\..\Program Files\
node\node_modules\webtorrent-mpv-hook\build\webtorrent.js]
06/30/2020  10:05 AM               571 win-helper.vbs
               4 File(s)         85,990 bytes
               3 Dir(s)  306,714,107,904 bytes free
mrxdst commented 2 years ago

The output from dir is interesting. There are multiple things that differs from the machine i'm testing on.

This really raises more questions than it answers.

If you want you could try editing the webtorrent.js file and drop some print() statements into the function getNodeScriptPath().
Fore example print(JSON.stringify(realPath, null, 2)); before the try { clause.

metapea commented 2 years ago

The output from dir is interesting. There are multiple things that differs from the machine i'm testing on.

  • Your symlink is relative while for me it's absolute. I would not expect this to matter but maybe it does.
  • Your the file seems to be linked to a package install location in C:\Program Files\node\node_modules. However I would expect the package to be installed in C:\Users\You\AppData\Roaming\npm\node_modules. Not sure why npm would do that.
  • Further the node install directory is also different. For me it's C:\Program Files\nodejs but for you it appears to be C:\Program Files\node

This really raises more questions than it answers.

It's not "installed", both mpv and the node are from zip files

If you want you could try editing the webtorrent.js print(JSON.stringify(realPath, null, 2));

thanks, i try it