Giter Site home page Giter Site logo

stareintheair / mpv-trakt-sync-daemon Goto Github PK

View Code? Open in Web Editor NEW
43.0 8.0 3.0 66 KB

Python daemon that scrobbles watch progress from https://mpv.io to https://trakt.tv

License: Other

Python 98.29% Batchfile 0.60% VBScript 1.11%
mpv trakt daemon synchronization scrobble

mpv-trakt-sync-daemon's People

Contributors

dependabot[bot] avatar orehunt avatar shizeeg avatar stareintheair avatar untoreh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mpv-trakt-sync-daemon's Issues

guessit 3.0.3 can't guess tv episodes correctly

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.

Bad Magic Number

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

windows named pipe doesn't connect

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

Python 3.7 Support

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.

mpv-trakt-sync-daemon is broken

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.

stuck MPV player broken pipe

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!

Won't run in background

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.

Absolute episode numbering

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

OSX autostart plist

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

TypeError: %d format: a number is required, not NoneType

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 ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.