|
1 | | -# TautulliPython2Trakt |
2 | | - Python script to send Tautulli notifications to Trakt |
| 1 | +<p align="center"> |
| 2 | + <a href="https://github.com/TheGeeKing/TautulliPython2Trakt"> |
| 3 | + <img src="image.png" alt="TautulliPython2Trakt's logo" width="80" height="80"> |
| 4 | + </a> |
| 5 | + <h1 align="center">Tautulli Python 2 Trakt</h1> |
| 6 | +</p> |
| 7 | + |
| 8 | +<h2> Table of Contents </h2> |
| 9 | + |
| 10 | +- [Description](#description) |
| 11 | +- [What it can do](#what-it-can-do) |
| 12 | +- [Requirements](#requirements) |
| 13 | +- [Installation](#installation) |
| 14 | + - [Script Setup](#script-setup) |
| 15 | + - [Tautulli Setup](#tautulli-setup) |
| 16 | + - [Scrobbling](#scrobbling) |
| 17 | + - [Collection](#collection) |
| 18 | +- [Usage](#usage) |
| 19 | +- [More info](#more-info) |
| 20 | +- [Similar Projects](#similar-projects) |
| 21 | + |
| 22 | +## Description |
| 23 | + |
| 24 | +Python script to scrobble what you watch, sync your collected movies and TV shows from [Tautulli](https://github.com/Tautulli/Tautulli) to [Trakt.tv](https://trakt.tv/). |
| 25 | + |
| 26 | +## What it can do |
| 27 | + |
| 28 | +- Track watched status of movies and TV shows |
| 29 | +- Sync collected movies and TV shows to Trakt.tv |
| 30 | + |
| 31 | +## Requirements |
| 32 | + |
| 33 | +- Tautulli 2.12.5 or higher |
| 34 | +- Python 3.11 or higher |
| 35 | +- install requirements.txt |
| 36 | + 1. `pip install -r requirements.txt` |
| 37 | + |
| 38 | +## Installation |
| 39 | + |
| 40 | +### Script Setup |
| 41 | + |
| 42 | +Download the latest release from [here](https://github.com/TheGeeKing/TautulliPython2Trakt/releases), unzip it and place all files in a folder. |
| 43 | + |
| 44 | +Create a new [application](https://trakt.tv/oauth/applications) Add the follow settings: |
| 45 | + |
| 46 | +**Name:** `TautulliPython2Trakt` **Redirect uri:** `urn:ietf:wg:oauth:2.0:oob` **Permissions:** `/scrobble` |
| 47 | + |
| 48 | +Run the script: |
| 49 | + |
| 50 | +```bash |
| 51 | +python TautulliPython2Trakt.py -setup |
| 52 | +``` |
| 53 | + |
| 54 | +Follow the setup steps. |
| 55 | + |
| 56 | +If you want to collect your movies and TV shows, you need to do the Plex Media Server setup! You might also want to add credentials/token to access your Plex Media Server as this can help to scrobble the correct episode to Trakt.tv if you don't use the TMDB database for sorting your shows. [How to find my token ?](https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/) |
| 57 | + |
| 58 | +### Tautulli Setup |
| 59 | + |
| 60 | +#### Scrobbling |
| 61 | + |
| 62 | +1. Go to Tautulli > `Settings` > `Notification Agents` > `Add a new notification agent` > `Script` |
| 63 | +2. Set the `Script Folder` to the folder where you placed the script, then select the script `TautulliPython2Trakt.py` in the `Script File` field. Put the `Script Timeout` to `0`. |
| 64 | +3. In the `Triggers` section, select: |
| 65 | + 1. `Playback Start` |
| 66 | + 2. `Playback Stop` |
| 67 | + 3. `Playback Pause` |
| 68 | + 4. `Playback Resume` |
| 69 | + 5. `Watched` |
| 70 | +4. Put conditions if you want to, like username, media type, etc. |
| 71 | +5. In the `Arguments` tab, put the following arguments: |
| 72 | + 1. Playback Start / Playback Resume: `pythonw -m {media_type} -s "{show_name}" -M "{title}" -y "{year}" -t "{thetvdb_id}" -i "{imdb_id}" -r {rating_key} -S {season_num} -E {episode_num} -P {progress_percent} -a start -PlexUser {username}` |
| 73 | + 2. Playback Stop / Watched: `pythonw -m {media_type} -s "{show_name}" -M "{title}" -y "{year}" -t "{thetvdb_id}" -i "{imdb_id}" -r {rating_key} -S {season_num} -E {episode_num} -P {progress_percent} -a stop -PlexUser {username}` |
| 74 | + 3. Playback Pause: `pythonw -m {media_type} -s "{show_name}" -M "{title}" -y "{year}" -t "{thetvdb_id}" -i "{imdb_id}" -r {rating_key} -S {season_num} -E {episode_num} -P {progress_percent} -a pause -PlexUser {username}` |
| 75 | + |
| 76 | +#### Collection |
| 77 | + |
| 78 | +1. Go to Tautulli > `Settings` > `Notification Agents` > `Add a new notification agent` > `Script`. |
| 79 | +2. Set the `Script Folder` to the folder where you placed the script, then select the script `TautulliPython2Trakt.py` in the `Script File` field. Put the `Script Timeout` to `0`. |
| 80 | +3. In the `Triggers` section, select `Recently Added`. |
| 81 | +4. Put conditions if you want to, like media type, etc. |
| 82 | +5. In the `Arguments` tab, put the following argument: |
| 83 | + 1. Recently Added: `<movie>pythonw -c movies -PlexUser {username}</movie><episode>pythonw -c episodes -PlexUser {username}</episode><season>pythonw -c episodes -PlexUser {username}</season><show>pythonw -c episodes -PlexUser {username}</show>` |
| 84 | + |
| 85 | +## Usage |
| 86 | + |
| 87 | +``` |
| 88 | +-h Help |
| 89 | +-setup Setup aplication |
| 90 | +-reset Reset settings and revoke token |
| 91 | +-refreshToken Refreshes the Trakt token |
| 92 | +-add Add a new Plex user |
| 93 | +-remove Remove a Plex user |
| 94 | +
|
| 95 | +------------------ Trakt Scrobbling ------------------ |
| 96 | +-m Media type (movie, show, episode) |
| 97 | +-a Action (start, pause, stop) |
| 98 | +-s Name of the TV Series |
| 99 | +-M Name of the Moviename |
| 100 | +-y Year of the movie/TV Show |
| 101 | +-S Season number |
| 102 | +-E Episode number |
| 103 | +-t TVDB ID |
| 104 | +-i IMDB ID |
| 105 | +-r ratingKey (Plex Server internal content id) |
| 106 | +-P Percentage progress (Ex: 10.0) |
| 107 | +-PlexUser The Plex username |
| 108 | +
|
| 109 | +------------------ Trakt Collection ------------------ |
| 110 | +-c Media type (movies, episodes) |
| 111 | +-PlexUser The Plex username |
| 112 | +``` |
| 113 | + |
| 114 | +## More info |
| 115 | + |
| 116 | +Default scrobbler behavior is for: |
| 117 | + |
| 118 | +- Movies, the data from Tautulli is sent directly to Trakt. |
| 119 | +- Episodes: |
| 120 | + - If your Plex Media Server is connected, we get the ratingkey from the data sent by Tautulli. We make a database filled with ratingkey paired to ids. We search for the ids linked to the ratingkey in the database. We send the ids to Trakt. Trakt.tv uses TMDB database, so sending basic info like season and episode number can mismatch with your plex configuration. This way we ensure that the episode is scrobbled to the correct one on the Trakt end. |
| 121 | + - If you are not connected to your Plex Media Server, we send the data from Tautulli directly to Trakt. |
| 122 | + |
| 123 | +## Similar Projects |
| 124 | + |
| 125 | +Inspired from: https://github.com/frugglehost/TautulliBatch2Trakt |
| 126 | + |
| 127 | +- https://github.com/JvSomeren/tautulli-watched-sync |
| 128 | +- https://github.com/xanderstrike/goplaxt |
| 129 | +- https://github.com/gazpachoking/trex |
| 130 | +- https://github.com/dabiggm0e/plextrakt |
| 131 | +- https://github.com/trakt/Plex-Trakt-Scrobbler |
| 132 | +- https://github.com/Generator/tautulli2trakt |
0 commit comments