stareintheair / mpv-trakt-sync-daemon Goto Github PK
View Code? Open in Web Editor NEWPython daemon that scrobbles watch progress from https://mpv.io to https://trakt.tv
License: Other
Python daemon that scrobbles watch progress from https://mpv.io to https://trakt.tv
License: Other
Unfortunately Trakt still doesn't support absolute numbering directly, so anyone trying to support it is on their own right now (Even though Trakt has all the data right there, it's not exposed in the API)
Since most Japanese shows are ordered absolutely, i.e. without seasons, this makes scrobbling e.g. anime next to impossible.
Trakt won't help so the only option is converting absolute to season numbering before interacting w/ the Trakt API, e.g. by using https://thexem.de
I might give it a shot and wanted to ask for opinions on the matter
I'm getting this :
Traceback (most recent call last):
File "./sync_daemon.py", line 364, in run_with_except_hook
run_original(*args2, **kwargs2)
File "/usr/lib/python3.7/threading.py", line 1166, in run
self.function(*self.args, **self.kwargs)
File "./sync_daemon.py", line 166, in sync_to_trakt
log.debug('sync_to_trakt(%s, %d, %s, %s, %d, %d, %s)' % (is_paused, playback_position, working_dir, path, duration, start_time, mpv_closed))
TypeError: %d format: a number is required, not NoneType
What could be the error ?
This project currently doesn't support Python 3.7 because 'trakt_key_holder.pyc' was compiled with Python 3.6 and the source isn't available. It can be decompiled by the user to make it work, but that seems a bit impractical.
Hi. Overall the script seems to work great!
I have an issue though. When I open mpv normally it works fine,
When I start mpv through syncplay it doesn't find the pipe however for whatever reason...
logs
I ran mpv seperately, to show it detects it, then I ran it in syncplay.
The only thing I changed in the logs is the server IP I was playing from
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:
[email protected] - mpv trakt sync daemon
Loaded: loaded (/etc/systemd/system/[email protected]; 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/[email protected]
└─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!
Everything is working as intended but neither using win-launch.bat nor win-hidden-launch.vbs
keeps the script active in the background.
EDIT: I fixed it myself. Problem was that I installed the modules globally so I switched to using the global pythonw.exe launcher.
2024-04-19 18:44:53,939 - launched
2024-04-19 18:48:23,992 - Windows named pipe connected
2024-04-19 18:48:24,998 - Command {'command': ['get_property', 'path'], 'request_id': 2} failed: {'request_id': 2, 'error': 'property unavailable'}
2024-04-19 18:48:24,998 - Command {'command': ['get_property', 'percent-pos'], 'request_id': 3} failed: {'request_id': 3, 'error': 'property unavailable'}
2024-04-19 18:48:24,999 - Command {'command': ['get_property', 'duration'], 'request_id': 5} failed: {'request_id': 5, 'error': 'property unavailable'}
2024-04-19 18:48:41,118 - Command {'command': ['get_property', 'percent-pos'], 'request_id': 8} failed: {'request_id': 8, 'error': 'property unavailable'}
2024-04-19 18:48:41,119 - Command {'command': ['get_property', 'duration'], 'request_id': 10} failed: {'request_id': 10, 'error': 'property unavailable'}
2024-04-19 18:48:44,139 - Command {'command': ['get_property', 'percent-pos'], 'request_id': 13} failed: {'request_id': 13, 'error': 'property unavailable'}
2024-04-19 18:48:44,139 - Command {'command': ['get_property', 'duration'], 'request_id': 15} failed: {'request_id': 15, 'error': 'property unavailable'}
2024-04-19 18:49:24,871 - requesting trakt id for show stream?static true&MediaSourceId 29310c6843caa1d0a253f
2024-04-19 18:49:25,833 - https://api.trakt.tv/scrobble/start 404
2024-04-19 18:49:55,059 - https://api.trakt.tv/scrobble/start 404
2024-04-19 18:50:13,938 - Exception while writing to Windows named pipe. Assuming pipe closed.
2024-04-19 18:50:13,938 - Windows named pipe closed
2024-04-19 18:50:13,953 - terminating
I used this daemon with jellyfin-mpv-shim for this test.
I've installed this on several linux distros and never had a problem like this. I am currently running OpenBSD and no matter how I install this I get the following:
(venv) da5id@tesla /usr/local/mpv-trakt-sync-daemon master ./sync_daemon.py
Traceback (most recent call last):
File "./sync_daemon.py", line 14, in
import trakt_key_holder
do you have any suggestions? i'm just stumped... At first I thought maybe for some strange reason it was trying to use python2 but when i force python2 to run it I get expected errors like:
Traceback (most recent call last):
File "./sync_daemon.py", line 7, in
import urllib.parse
ImportError: No module named parse
guessit 3.0.3 can't guess tv episodes named XXX.SxxExx.720p.HDTV.x264-XXX.mkv correctly, the result being a movie titled "XXX SxxExx". Updating to guessit 3.1.0 solved the problem. Therefore requirements.txt and requirements-win.txt should be updated.
usecase:
create file "org.mpvtraktsync.plist" in "~/Library/LaunchAgents/" with following content
edit /Path/To/
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.user.mpvtraktsync</string>
<key>ProgramArguments</key>
<array>
<string>**/Path/To/**mpv-trakt-sync-daemon/venv/bin/python3</string>
<string>sync_daemon.py</string>
</array>
<key>WorkingDirectory</key>
<string>**/Path/To/**mpv-trakt-sync-daemon</string>
<key>RunAtLoad</key>
<true />
<key>LaunchOnlyOnce</key>
<true />
<key>KeepAlive</key>
<true />
</dict>
</plist>
execute following command in terminal
launchctl load ~/Library/LaunchAgents/org.mpvtraktsync.plist
verify by running following command
launchctl list | grep org.user.mpvtraktsync
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.