fauu / Kamite

Japanese immersion assistant for learners (Windows/Linux)
GNU Affero General Public License v3.0
110 stars 2 forks source link

No socket pipe "\\.\pipe\kamite-mpvsocket" #12

Closed lyfenwebos closed 1 year ago

lyfenwebos commented 1 year ago

Trying to extract chunks from anime, but there is no such pipe, although logs state that Kamite is waiting for mpv connections. Checked active pipes > it is indeed not present.

Full Log WARN StatusConsoleListener The use of package scanning to locate plugins is deprecated and will be removed in a future release WARN StatusConsoleListener The use of package scanning to locate plugins is deprecated and will be removed in a future release WARN StatusConsoleListener The use of package scanning to locate plugins is deprecated and will be removed in a future release WARN StatusConsoleListener The use of package scanning to locate plugins is deprecated and will be removed in a future release [INFO ] 21:05:04 [main] Kamite - Starting Kamite (version 0.13) [INFO ] 21:05:04 [main] Kamite - Initialized support for platform WindowsPlatform [DEBUG] 21:05:04 [main] ConfigManager - Read config: Config[chunk=Chunk[correct=true, filter=Filter[rejectPatterns=[^Textractor]], flash=true, furigana=Furigana[conceal=true, enable=true], log=Log[dir=null], throttleMS=1000, transforms=null, translationOnlyMode=false], commands=Commands[custom=null, player=Player[showExtra=true]], controlWindow=true, dev=Dev[serveStaticInDevMode=false], events=Events[handlers=null], integrations=Integrations[agent=Agent[enable=false, host=127.0.0.1:9001]], keybindings=Keybindings[global=Global[ocr=GlobalKeybindingsOCR[autoBlock=shift X, autoBlockSelect=null, manualBlock=shift Z, manualBlockRotated=null, region=null]]], launchBrowser=true, lookup=Lookup[targets=[Target[name=jisho, newTab=false, symbol=jsh, url=https://jisho.org/search/{}], Target[name=RomajiDesu, newTab=false, symbol=rmj, url=https://www.romajidesu.com/translator/{}], Target[name=DeepL, newTab=false, symbol=DEP, url=https://www.deepl.com/translator#ja/en/{}], Target[name=ichi.moe, newTab=false, symbol=ICH, url=https://ichi.moe/cl/qr/?q={}&r=kana], Target[name=jpdb, newTab=false, symbol=JDB, url=https://jpdb.io/search?q={}], Target[name=Google Images, newTab=true, symbol=GLI, url=https://www.google.com/search?q={}%20site%3Ajp&tbm=isch]]], ocr=OCR[engine=MANGAOCR, mangaocr=Mangaocr[pythonPath=null], ocrspace=Ocrspace[engine=1], regions=null, tesseract=Tesseract[path=C:\Users\<user>\AppData\Local\Programs\Tesseract-OCR\tesseract.exe], watchDir=null], secrets=Secrets[ocrspace=null], server=Server[port=4110], sessionTimer=SessionTimer[autoPause=AutoPause[after=null, enable=true], startPaused=false], ui=Ui[focusMode=false, layout=STANDARD, notebook=Notebook[collapse=false, height=60]], update=Update[check=true]] [INFO ] 21:05:05 [main] Server - Started backend web server (port 4110) [INFO ] 21:05:05 [main] Kamite - Navigated to web UI URL in web browser [DEBUG] 21:05:05 [JettyServerThreadPool-Virtual-14] Server - Custom CSS file not found [INFO ] 21:05:05 [main] Kamite - Created control window (Kamite version 0.13) [INFO ] 21:05:05 [main] ChunkFilter - Initialized chunk filter [DEBUG] 21:05:05 [main] WindowsMPVController - Starting mpv controller worker thread [DEBUG] 21:05:05 [Thread-3] BaseMPVController - Waiting for mpv connection [INFO ] 21:05:05 [main] Kamite - Registered global keybinding: shift X [INFO ] 21:05:05 [main] Kamite - Registered global keybinding: shift Z [DEBUG] 21:05:05 [] GenericPlatform - Program path determined to be: C:\kamite [INFO ] 21:05:05 [] MangaOCRController - Starting "Manga OCR" usingC:\Users\.local\pipx\venvs\manga-ocr\Scripts\python.exe [INFO ] 21:05:05 [JettyServerThreadPool-Virtual-13] Kamite - Client connected [DEBUG] 21:05:05 [AWT-EventQueue-0] Frame - Initialized control GUI [DEBUG] 21:05:05 [JettyServerThreadPool-Virtual-13] Server - Sent a 'program-status' message [DEBUG] 21:05:05 [] Releases - Exception while getting latest release information javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure at jdk.internal.net.http.HttpClientImpl.send(Unknown Source) ~[java.net.http:?] at jdk.internal.net.http.HttpClientFacade.send(Unknown Source) ~[java.net.http:?] at io.github.kamitejp.meta.Releases.checkNewAvailable(Releases.java:40) ~[kamite.jar:?] at io.github.kamitejp.Kamite.notifyIfNewerVersionAvailable(Kamite.java:356) ~[kamite.jar:?] at io.github.kamitejp.Kamite.lambda$run$11(Kamite.java:327) ~[kamite.jar:?] at java.util.concurrent.ThreadPerTaskExecutor$TaskRunner.run(Unknown Source) ~[?:?] at java.lang.VirtualThread.run(Unknown Source) ~[?:?] at java.lang.VirtualThread$VThreadContinuation.lambda$new$0(Unknown Source) ~[?:?] at jdk.internal.vm.Continuation.enter0(Unknown Source) [?:?] at jdk.internal.vm.Continuation.enter(Unknown Source) [?:?] Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure at sun.security.ssl.Alert.createSSLException(Unknown Source) ~[?:?] at sun.security.ssl.Alert.createSSLException(Unknown Source) ~[?:?] at sun.security.ssl.TransportContext.fatal(Unknown Source) ~[?:?] at sun.security.ssl.Alert$AlertConsumer.consume(Unknown Source) ~[?:?] at sun.security.ssl.TransportContext.dispatch(Unknown Source) ~[?:?] at sun.security.ssl.SSLTransport.decode(Unknown Source) ~[?:?] at sun.security.ssl.SSLEngineImpl.decode(Unknown Source) ~[?:?] at sun.security.ssl.SSLEngineImpl.readRecord(Unknown Source) ~[?:?] at sun.security.ssl.SSLEngineImpl.unwrap(Unknown Source) ~[?:?] at sun.security.ssl.SSLEngineImpl.unwrap(Unknown Source) ~[?:?] at javax.net.ssl.SSLEngine.unwrap(Unknown Source) ~[?:?] at jdk.internal.net.http.common.SSLFlowDelegate$Reader.unwrapBuffer(Unknown Source) ~[java.net.http:?] at jdk.internal.net.http.common.SSLFlowDelegate$Reader.processData(Unknown Source) ~[java.net.http:?] at jdk.internal.net.http.common.SSLFlowDelegate$Reader$ReaderDownstreamPusher.run(Unknown Source) ~[java.net.http:?] at jdk.internal.net.http.common.SequentialScheduler$LockingRestartableTask.run(Unknown Source) ~[java.net.http:?] at jdk.internal.net.http.common.SequentialScheduler$CompleteRestartableTask.run(Unknown Source) ~[java.net.http:?] at jdk.internal.net.http.common.SequentialScheduler$SchedulableTask.run(Unknown Source) ~[java.net.http:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[?:?] at java.lang.Thread.run(Unknown Source) ~[?:?] [DEBUG] 21:05:06 [JettyServerThreadPool-Virtual-13] Server - Sent a 'config' message [DEBUG] 21:05:08 [] MangaOCRController - Received output line from "Manga OCR": C:\Users\<user>\.local\pipx\venvs\manga-ocr\lib\site-packages\transformers\models\vit\feature_extraction_vit.py:28: FutureWarning: The class ViTFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please use ViTImageProcessor instead. [DEBUG] 21:05:08 [] MangaOCRController - Received output line from "Manga OCR": warnings.warn( [DEBUG] 21:05:10 [] MangaOCRController - Received output line from "Manga OCR": READY [DEBUG] 21:05:10 [] Server - Sent a 'program-status' message [INFO ] 21:05:11 [] Recognizer - Initialized recognizer. Engine: "Manga OCR"

lyfenwebos commented 1 year ago

Sorry, did not know Github parses logs that badly :(

fauu commented 1 year ago

mpv needs to be instructed to create the pipe. Do you have either input-ipc-server=\\.\pipe\kamite-mpvsocket in your mpv config or --input-ipc-server=\\.\pipe\kamite-mpvsocket as a parameter when launching mpv?

lyfenwebos commented 1 year ago

Yes, I added to the mpv config file corresponding line and mpv could not start with error "failed to connect to the socket" or similar. Will check for exact error in the evening. I thought kamite creates a socket and waits for connections from mpv,but it is the other way around. I'll play with mpv config.

lyfenwebos commented 1 year ago

Okey, figured it out. My mistake, sorry :)

lyfenwebos commented 1 year ago

I tried searching for answers on the Internet, but failed :/ I'm using Jellyfin Media server + Media player Media player has built-in mpv player and supports configuration. I set --input-ipc-server=\\.\pipe\kamite-mpvsocket as a parameter, but Kamite seems to fail during initialization, in mpv logs I see "client connected, client disconnected" with new connection number each time.

So the question is, do you know if mpv supports multiple connections to a single socket? I tried connecting Kamite to bare mpv and it does work, so I assume mpv may no support it several connections, but could not find the confirmation or maybe there is an issue on Kamite side?

[INFO ] 19:03:36 [Thread-3] WindowsMPVController - Connected to mpv pipe at \\.\pipe\kamite-mpvsocket
[DEBUG] 19:03:36 [Thread-3] BaseMPVController - Sent mpv IPC command: {"command": ["observe_property", 0, "pause"]}\n
[DEBUG] 19:03:36 [Thread-3] BaseMPVController - Sent mpv IPC command: {"command": ["observe_property", 0, "sub-text"]}\n
[DEBUG] 19:03:36 [Thread-3] BaseMPVController - Sent mpv IPC command: {"command": ["observe_property", 0, "sub-start"]}\n
[DEBUG] 19:03:36 [Thread-3] BaseMPVController - Sent mpv IPC command: {"command": ["observe_property", 0, "secondary-sub-text"]}\n
[DEBUG] 19:03:36 [Thread-3] BaseMPVController - Sent mpv IPC command: {"command": ["observe_property", 0, "secondary-sub-start"]}\n
[DEBUG] 19:03:36 [Thread-3] BaseMPVController - Received mpv messages: {"request_id":0,"error":"success"}
[DEBUG] 19:03:36 [Thread-3] BaseMPVController - Received mpv messages: {"event":"property-change","name":"pause","data":false}
[ERROR] 19:03:36 [Thread-3] WindowsMPVController - Error when reading from mpv pipe. See stderr for the stack trace
java.io.InterruptedIOException
        at org.eclipse.jetty.util.FutureCallback.block(FutureCallback.java:153)
        at org.eclipse.jetty.util.FutureCallback.block(FutureCallback.java:139)
        at org.eclipse.jetty.websocket.common.JettyWebSocketRemoteEndpoint.sendBlocking(JettyWebSocketRemoteEndpoint.java:191)
        at org.eclipse.jetty.websocket.common.JettyWebSocketRemoteEndpoint.sendString(JettyWebSocketRemoteEndpoint.java:52)
        at io.javalin.websocket.WsContext.send(WsContext.kt:41)
        at io.github.kamitejp.server.Server.send(Server.java:116)
        at io.github.kamitejp.Kamite.sendStatus(Kamite.java:805)
        at io.github.kamitejp.Kamite.handlePlayerStatusUpdate(Kamite.java:497)
        at io.github.kamitejp.platform.mpv.BaseMPVController.handleMessages(BaseMPVController.java:95)
        at io.github.kamitejp.platform.mpv.WindowsMPVController$Worker.runReader(WindowsMPVController.java:116)
        at io.github.kamitejp.platform.mpv.BaseMPVController$BaseWorker.run(BaseMPVController.java:161)
        at io.github.kamitejp.platform.mpv.BaseMPVController$BaseWorker.run(BaseMPVController.java:178)
        at io.github.kamitejp.platform.mpv.BaseMPVController$BaseWorker.run(BaseMPVController.java:178)
        at io.github.kamitejp.platform.mpv.BaseMPVController$BaseWorker.run(BaseMPVController.java:178)
        at io.github.kamitejp.platform.mpv.BaseMPVController$BaseWorker.run(BaseMPVController.java:178)
        at io.github.kamitejp.platform.mpv.BaseMPVController$BaseWorker.run(BaseMPVController.java:178)
        at io.github.kamitejp.platform.mpv.BaseMPVController$BaseWorker.run(BaseMPVController.java:178)
        at io.github.kamitejp.platform.mpv.BaseMPVController$BaseWorker.run(BaseMPVController.java:178)
        at io.github.kamitejp.platform.mpv.BaseMPVController$BaseWorker.run(BaseMPVController.java:178)
        at io.github.kamitejp.platform.mpv.BaseMPVController$BaseWorker.run(BaseMPVController.java:178)
        at io.github.kamitejp.platform.mpv.BaseMPVController$BaseWorker.run(BaseMPVController.java:178)
        at io.github.kamitejp.platform.mpv.BaseMPVController$BaseWorker.run(BaseMPVController.java:178)
        at io.github.kamitejp.platform.mpv.BaseMPVController$BaseWorker.run(BaseMPVController.java:178)
        at io.github.kamitejp.platform.mpv.BaseMPVController$BaseWorker.run(BaseMPVController.java:178)
        at io.github.kamitejp.platform.mpv.BaseMPVController$BaseWorker.run(BaseMPVController.java:178)
        at io.github.kamitejp.platform.mpv.BaseMPVController$BaseWorker.run(BaseMPVController.java:178)
        at io.github.kamitejp.platform.mpv.BaseMPVController$BaseWorker.run(BaseMPVController.java:178)
        at io.github.kamitejp.platform.mpv.BaseMPVController$BaseWorker.run(BaseMPVController.java:178)
        at io.github.kamitejp.platform.mpv.BaseMPVController$BaseWorker.run(BaseMPVController.java:178)
        at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.InterruptedException
        at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(Unknown Source)
        at java.base/java.util.concurrent.CountDownLatch.await(Unknown Source)
        at org.eclipse.jetty.util.FutureCallback.get(FutureCallback.java:114)
        at org.eclipse.jetty.util.FutureCallback.block(FutureCallback.java:149)
        ... 29 more
[DEBUG] 19:03:36 [Thread-3] Server - Sent a 'program-status' message
[INFO ] 19:03:36 [Thread-3] BaseMPVController - mpv disconnected
lyfenwebos commented 1 year ago

Okey, figured it out --idle=1 along with --input-ipc-server=\\.\pipe\kamite-mpvsocket appears to be a proper configuration. Sorry for bothering and thanks for the Kamite :)

lyfenwebos commented 1 year ago

Okey, seems like final addition to the issue that I had. For me Kamite seems to not connect to the mpv when started in Debug mode. In Normal mode no issues. Just for a reference if anyone is needed, not sure if it is a bug though. Might error specifically on my system.

fauu commented 1 year ago

Thanks for all the information, it's no bother at all. I'll try to replicate the issues on my side.

fauu commented 1 year ago

I've reproduced the issue with the connect–disconnect loop. I don't know the exact cause, but in the meantime I've improved the Windows mpv integration code and this seems to have fixed the problem already, so it should work okay in the next version (0.14) without the idle workaround.

The Debug mode part I couldn't reproduce. I can't think of anything specific to the Debug mode able to make the difference between it working and not working, so for now I'm going to leave this be.