mpv-remote-app icon indicating copy to clipboard operation
mpv-remote-app copied to clipboard

[bug] Support mpv.net frontend

Open stax76 opened this issue 2 years ago • 2 comments

I was able to use mpv-remote-app with mpv, but with mpv.net I get an error:

Desktop> mpvnet
[mpvremote] true
[mpvremote] {"error_string":"","killed_by_us":false,"status":1,"stderr":"node:internal/modules/cjs/loader:936\r\n  throw err;\r\n  ^\r\n\r\nError: Cannot find module 'express'\r\nRequire stack:\r\n- C:\\Users\\frank\\AppData\\Roaming\\mpv.net\\scripts\\mpvremote\\remoteServer.js\r\n    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)\r\n    at Function.Module._load (node:internal/modules/cjs/loader:778:27)\r\n    at Module.require (node:internal/modules/cjs/loader:1005:19)\r\n    at require (node:internal/modules/cjs/helpers:102:18)\r\n    at Object.<anonymous> (C:\\Users\\frank\\AppData\\Roaming\\mpv.net\\scripts\\mpvremote\\remoteServer.js:9:17)\r\n    at Module._compile (node:internal/modules/cjs/loader:1105:14)\r\n    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)\r\n    at Module.load (node:internal/modules/cjs/loader:981:32)\r\n    at Function.Module._load (node:internal/modules/cjs/loader:822:12)\r\n    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {\r\n  code: 'MODULE_NOT_FOUND',\r\n  requireStack: [\r\n    'C:\\\\Users\\\\frank\\\\AppData\\\\Roaming\\\\mpv.net\\\\scripts\\\\mpvremote\\\\remoteServer.js'\r\n  ]\r\n}\r\n"}
[mpvremote] ""

stax76 avatar Jul 10 '22 17:07 stax76

I got it working with MPV.Net so the issue probably you just copy pasted the files you got on mpv directory, which is wrong. remoteserver.js and watchlisthandler.js are symbolic links. If you copy paste file under Windows they are losing the symbolic link state. For next release on mpv-remote-node I'll create an installer which gonna support custom MPV frontends. Until then, you can install with something like this using PowerShell (as admin):

First delete mpv-remote from your mpv.net scripts directory, then: Change YourUser into your username.

xcopy /i "C:\Users\YourUser\AppData\Roaming\npm\node_modules\mpv-remote\mpvremote" "$env:APPDATA\mpv.net\scripts\mpvremote"
New-Item -ItemType SymbolicLink -Path "$env:APPDATA\mpv.net\scripts\mpvremote\remoteServer.js" -Target "C:\Users\YourUser\AppData\Roaming\npm\node_modules\mpv-remote\remoteServer.js"
# Watchlist handler
New-Item -ItemType SymbolicLink -Path "$env:APPDATA\mpv.net\scripts\mpvremote\watchlisthandler.js" -Target "C:\Users\YourUser\AppData\Roaming\npm\node_modules\mpv-remote\watchlisthandler.js"
# If you need default config
echo f | xcopy /f /y "C:\Users\YourUser\AppData\Roaming\npm\node_modules\mpv-remote\mpvremote.conf" "$env:APPDATA\mpv.net\script-opts"

husudosu avatar Jul 10 '22 17:07 husudosu

I didn't notice there are symlinks, thanks for the support, it's working fine with that.

stax76 avatar Jul 10 '22 19:07 stax76