Skip to content

Commit d1ee90e

Browse files
committed
TautulliPython2Trakt v1.1.0
### Added - This CHANGELOG.md file. - GitHub Templates for Bug Reports and Feature Requests. - Syncing behavior section in the README.md file. - More info for the `-PlexUser` argument in the README.md file and when using the `-h` argument. ### Fixed - Sync collections now correctly works. - Sentences in README.md file now go correctly to the next line and grammar mistakes. - Syncing collections now correctly works. - Now correctly log the arguments passed before calling `subprocess.check_output()`. - Fixed some puctuation mistakes. ### Changed - Argument for the recently added in the README.md file. - Syncing collection can now either find the owner username, sync all users found in the env, or sync a list of users. - Sorted imports. - Now gets `HEADERS` from a function in utilities.py for less redundancy. ### Removed - Unused import os in scrobble.py. - Unused `arguments_string` variable in the TautulliPython2Trakt.py file.
1 parent c3aa8a7 commit d1ee90e

8 files changed

Lines changed: 308 additions & 61 deletions

File tree

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Bug report
2+
description: Create a new ticket for a bug.
3+
title: "🐛 [BUG]: "
4+
labels:
5+
- bug
6+
- triage
7+
assignees:
8+
- TheGeeKing
9+
body:
10+
- type: textarea
11+
attributes:
12+
label: Description
13+
description: A clear and concise description of the problem.
14+
validations:
15+
required: true
16+
- type: textarea
17+
attributes:
18+
label: Expected behavior
19+
placeholder: A clear and concise description of what you expected to happen.
20+
- type: textarea
21+
attributes:
22+
label: Minimal Reproduction
23+
description: Provide steps to reproduce the problem.
24+
value: |-
25+
1. Go to '...'
26+
2. Click on '....'
27+
3. Scroll down to '....'
28+
4. See error
29+
validations:
30+
required: true
31+
- type: textarea
32+
attributes:
33+
label: Exception or Error
34+
description: provide error logs
35+
- type: textarea
36+
attributes:
37+
label: Screenshots/Screen recording
38+
description: If applicable, add screenshots/recording to help explain your problem.
39+
placeholder: Add screenshots/recording here
40+
- type: input
41+
attributes:
42+
label: Operating System and Version
43+
placeholder: eg. Windows 10, macOS 10.15, Ubuntu 20.04, etc.
44+
validations:
45+
required: true
46+
- type: input
47+
attributes:
48+
label: Python Version
49+
placeholder: e.g. 3.11
50+
validations:
51+
required: true
52+
- type: input
53+
attributes:
54+
label: Tautulli version
55+
description: Check Tautulli > Settings > Help & Info.
56+
placeholder: e.g. 2.12.5
57+
validations:
58+
required: true
59+
- type: input
60+
attributes:
61+
label: Plex Media Server Version
62+
description: Check Plex Server > Settings (not Plex Web) > General.
63+
placeholder: eg. 1.75.0.3920
64+
validations:
65+
required: true
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: 💡 Feature Request
2+
description: Create a new ticket for a new feature request.
3+
title: "💡 [Feature Request]: "
4+
labels:
5+
- enhancement
6+
- triage
7+
assignees:
8+
- TheGeeKing
9+
body:
10+
- type: textarea
11+
attributes:
12+
label: Description
13+
description: A clear and concise description of the problem or missing capability.
14+
placeholder: I'm always frustrated when [...]. I would like to [...].
15+
validations:
16+
required: true
17+
- type: textarea
18+
attributes:
19+
label: Describe the solution you'd like
20+
description: If you have a solution in mind, please describe it.
21+
- type: textarea
22+
attributes:
23+
label: Describe alternatives you've considered
24+
description: Have you considered any alternative solutions or workarounds?

CHANGELOG.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Changelog <!-- omit from toc -->
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## [Unreleased]
8+
9+
- Refactor code for requests.
10+
- Use a proper logging module.
11+
- Use proper argument conventions (-h, --help, case) and maybe an argument parser.
12+
- Maybe use a different way to `sys.exit()` known errors.
13+
14+
## [1.1.0] - 2023-08-07
15+
16+
### Added
17+
18+
- This CHANGELOG.md file.
19+
- GitHub Templates for Bug Reports and Feature Requests.
20+
- Syncing behavior section in the README.md file.
21+
- More info for the `-PlexUser` argument in the README.md file and when using the `-h` argument.
22+
23+
### Fixed
24+
25+
- Sync collections now correctly works.
26+
- Sentences in README.md file now go correctly to the next line and grammar mistakes.
27+
- Syncing collections now correctly works.
28+
- Now correctly log the arguments passed before calling `subprocess.check_output()`.
29+
- Fixed some puctuation mistakes.
30+
31+
### Changed
32+
33+
- Argument for the recently added in the README.md file.
34+
- Syncing collection can now either find the owner username, sync all users found in the env, or sync a list of users.
35+
- Sorted imports.
36+
- Now gets `HEADERS` from a function in utilities.py for less redundancy.
37+
38+
### Removed
39+
40+
- Unused import os in scrobble.py.
41+
- Unused `arguments_string` variable in the TautulliPython2Trakt.py file.
42+
43+
## [1.0.0] - 2023-05-27
44+
45+
### Added
46+
47+
- Initial release of TautulliPython2Trakt v1.0.0.
48+
49+
[unreleased]: https://github.com/TheGeeKing/TautulliPython2Trakt/compare/v1.1.0...main
50+
[1.1.0]: https://github.com/TheGeeKing/TautulliPython2Trakt/compare/v1.0.0...v1.1.0
51+
[1.0.0]: https://github.com/TheGeeKing/TautulliPython2Trakt/releases/tag/v1.0.0

README.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<h1 align="center">Tautulli Python 2 Trakt</h1>
66
</p>
77

8-
<h2> Table of Contents </h2>
8+
## Table of Contents <!-- omit from toc -->
99

1010
- [Description](#description)
1111
- [What it can do](#what-it-can-do)
@@ -41,9 +41,11 @@ Python script to scrobble what you watch, sync your collected movies and TV show
4141

4242
Download the latest release from [here](https://github.com/TheGeeKing/TautulliPython2Trakt/releases), unzip it and place all files in a folder.
4343

44-
Create a new [application](https://trakt.tv/oauth/applications) Add the follow settings:
44+
Create a new [application](https://trakt.tv/oauth/applications) and add the following settings:
4545

46-
**Name:** `TautulliPython2Trakt` **Redirect uri:** `urn:ietf:wg:oauth:2.0:oob` **Permissions:** `/scrobble`
46+
**Name:** `TautulliPython2Trakt` \
47+
**Redirect uri:** `urn:ietf:wg:oauth:2.0:oob` \
48+
**Permissions:** `/scrobble`
4749

4850
Run the script:
4951

@@ -80,7 +82,7 @@ If you want to collect your movies and TV shows, you need to do the Plex Media S
8082
3. In the `Triggers` section, select `Recently Added`.
8183
4. Put conditions if you want to, like media type, etc.
8284
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>`
85+
1. Recently Added: `<movie>pythonw -c movies -PlexUser %OWNER%</movie><episode>pythonw -c episodes -PlexUser %OWNER%</episode><season>pythonw -c episodes -PlexUser %OWNER%</season><show>pythonw -c episodes -PlexUser %OWNER%</show>`
8486

8587
## Usage
8688

@@ -108,7 +110,7 @@ If you want to collect your movies and TV shows, you need to do the Plex Media S
108110
109111
------------------ Trakt Collection ------------------
110112
-c Media type (movies, episodes)
111-
-PlexUser The Plex username
113+
-PlexUser The Plex username (check 'Syncing behavior' in section 'More info' in the README.md file)
112114
```
113115

114116
## More info
@@ -120,6 +122,14 @@ Default scrobbler behavior is for:
120122
- 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.
121123
- If you are not connected to your Plex Media Server, we send the data from Tautulli directly to Trakt.
122124

125+
Syncing behavior:
126+
127+
- Based on the -c argument, we either sync movies or episodes. It is syncing your entire collection, not just the recently added, so it might take some time. If it takes way too much time, open an issue and I might add/find a way to only sync the recently added content.
128+
- Based on the -PlexUser argument:
129+
- (default behavior) `%OWNER%`, we sync the collections to the owner Trakt account.
130+
- If a user is specified, we sync the collections to the specified user Trakt account. ⚠️ **It will sync like if it was the owner, so even if the user has not access to the library where the content was added.** You can also use a list: `"[username1, username2]"`, typo is very important.
131+
- If `%ALL%` is specified, we sync the collections to all the users Trakt account. It will check if the users have access to the content before adding it to their collection.
132+
123133
## Similar Projects
124134

125135
Inspired from: https://github.com/frugglehost/TautulliBatch2Trakt

TautulliPython2Trakt.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from dotenv import load_dotenv, set_key
99
from plexapi.myplex import MyPlexAccount
1010

11-
from utilities import ProgressBar, log, get_from_env
11+
from utilities import ProgressBar, get_from_env, log
1212

1313
args = sys.argv[1:]
1414

@@ -44,7 +44,7 @@
4444
4545
------------------ Trakt Collection ------------------
4646
-c Media type (movies, episodes)
47-
-PlexUser The Plex username
47+
-PlexUser The Plex username (check 'Syncing behavior' in section 'More info' in the README.md file)
4848
#-A Collection action (add, remove)
4949
5050
"""
@@ -325,7 +325,6 @@ def less_month_expiration_token_users(data):
325325

326326
NUMBER_OF_ARGS = len(args)
327327

328-
arguments_string = ""
329328
arguments_list = []
330329
if args[0] == "-m":
331330
SCROBBLE = True
@@ -340,15 +339,14 @@ def less_month_expiration_token_users(data):
340339
next_arg = args[i + 1] if i + 1 < NUMBER_OF_ARGS else ""
341340
if " " in next_arg:
342341
next_arg = f'"{next_arg}"'
343-
arguments_string += f"{current_arg} {next_arg} "
344342
arguments_list += [current_arg, next_arg]
345343
i += 2
346344
else:
347345
i += 1
348346
else:
349347
SCROBBLE = False
350348

351-
log(f"ARGUMENTS: {arguments_string}")
349+
log(f"ARGUMENTS: {args}")
352350

353351
log(f"SCROBBLE: {SCROBBLE}")
354352
if SCROBBLE:

scrobble.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import json
2-
import os
32
import sys
43
import time
54

0 commit comments

Comments
 (0)