StareInTheAir/mpv-trakt-sync-daemon

stuck MPV player broken pipe

Closed this issue · 4 comments

Anytime I use mpv other than watching movies or tv shows such as youtube/music/misc vids it freezes the mpv player process. I actually have to pkill the process twice to get it to die. I noticed this always happens when it tries to scrobble something it doesn't understand and I get the following:
mpv-trakt-sync@da5id.service - mpv trakt sync daemon
Loaded: loaded (/etc/systemd/system/mpv-trakt-sync@.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2018-09-21 16:01:54 EDT; 20h ago
Main PID: 17848 (python3)
Tasks: 2 (limit: 3891)
Memory: 6.6M
CGroup: /system.slice/system-mpv\x2dtrakt\x2dsync.slice/mpv-trakt-sync@da5id.service
└─17848 /home/da5id/scripts/mpv-trakt-sync-daemon/venv/bin/python3 sync_daemon.py

Sep 22 12:46:26 tesla python3[17848]: Unhandled exception
Sep 22 12:46:26 tesla python3[17848]: Traceback (most recent call last):
Sep 22 12:46:26 tesla python3[17848]: File "sync_daemon.py", line 348, in run_with_except_hook
Sep 22 12:46:26 tesla python3[17848]: run_original(*args2, **kwargs2)
Sep 22 12:46:26 tesla python3[17848]: File "/usr/lib/python3.7/threading.py", line 865, in run
Sep 22 12:46:26 tesla python3[17848]: self._target(*self._args, **self._kwargs)
Sep 22 12:46:26 tesla python3[17848]: File "/home/da5id/scripts/mpv-trakt-sync-daemon/mpv.py", line 152, in run
Sep 22 12:46:26 tesla python3[17848]: self.sock.send(self.write_queue.get_nowait())
Sep 22 12:46:26 tesla python3[17848]: BrokenPipeError: [Errno 32] Broken pipe
Sep 22 12:46:26 tesla python3[17848]: mpv closed

So I have identified when this occurs and have kind of "worked around it". I will stop and start the mpv-trakt-sync-daemon service. Just wondering if there was any other way we could handle these issues other than stopping the daemon when I want to watch youtube videos in mpv via youtube-viewer or anything else. Thank you for your time. This is an amazing script btw I don't know where I would be without it!

Hello! Thanks for the kind words 😊
I can't reproduce this exception you get, but I'm also not testing on Unix. I get another exception when closing mpv after watching a YouTube video. I should fix both, but don't really have the time now.

But I can offer you another workaround. You put this in your config:

"excluded_directories": [
  "https://www.youtube.com/"
]

This prevents my daemon from trying to scrobble any YouTube videos to trakt. It will still try to extract the movie title, so it might not help with your exception, but it's worth try.

44bb5af
I also made this the default now.

Thank you so much!

My task today is to get this working on OpenBSD hopefully it won't be too hard lol