Skip to content

Commit

Permalink
TautulliPython2Trakt v1.1.0
Browse files Browse the repository at this point in the history
### 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.
  • Loading branch information
TheGeeKing committed Aug 6, 2023
1 parent c3aa8a7 commit d1ee90e
Show file tree
Hide file tree
Showing 8 changed files with 308 additions and 61 deletions.
65 changes: 65 additions & 0 deletions .github/ISSUE_TEMPLATE/BUG-REPORT.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Bug report
description: Create a new ticket for a bug.
title: "🐛 [BUG]: "
labels:
- bug
- triage
assignees:
- TheGeeKing
body:
- type: textarea
attributes:
label: Description
description: A clear and concise description of the problem.
validations:
required: true
- type: textarea
attributes:
label: Expected behavior
placeholder: A clear and concise description of what you expected to happen.
- type: textarea
attributes:
label: Minimal Reproduction
description: Provide steps to reproduce the problem.
value: |-
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
validations:
required: true
- type: textarea
attributes:
label: Exception or Error
description: provide error logs
- type: textarea
attributes:
label: Screenshots/Screen recording
description: If applicable, add screenshots/recording to help explain your problem.
placeholder: Add screenshots/recording here
- type: input
attributes:
label: Operating System and Version
placeholder: eg. Windows 10, macOS 10.15, Ubuntu 20.04, etc.
validations:
required: true
- type: input
attributes:
label: Python Version
placeholder: e.g. 3.11
validations:
required: true
- type: input
attributes:
label: Tautulli version
description: Check Tautulli > Settings > Help & Info.
placeholder: e.g. 2.12.5
validations:
required: true
- type: input
attributes:
label: Plex Media Server Version
description: Check Plex Server > Settings (not Plex Web) > General.
placeholder: eg. 1.75.0.3920
validations:
required: true
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/FEATURE-REQUEST.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: 💡 Feature Request
description: Create a new ticket for a new feature request.
title: "💡 [Feature Request]: "
labels:
- enhancement
- triage
assignees:
- TheGeeKing
body:
- type: textarea
attributes:
label: Description
description: A clear and concise description of the problem or missing capability.
placeholder: I'm always frustrated when [...]. I would like to [...].
validations:
required: true
- type: textarea
attributes:
label: Describe the solution you'd like
description: If you have a solution in mind, please describe it.
- type: textarea
attributes:
label: Describe alternatives you've considered
description: Have you considered any alternative solutions or workarounds?
51 changes: 51 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Changelog <!-- omit from toc -->

All notable changes to this project will be documented in this file.

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).

## [Unreleased]

- Refactor code for requests.
- Use a proper logging module.
- Use proper argument conventions (-h, --help, case) and maybe an argument parser.
- Maybe use a different way to `sys.exit()` known errors.

## [1.1.0] - 2023-08-07

### 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.0.0] - 2023-05-27

### Added

- Initial release of TautulliPython2Trakt v1.0.0.

[unreleased]: https://github.com/TheGeeKing/TautulliPython2Trakt/compare/v1.1.0...main
[1.1.0]: https://github.com/TheGeeKing/TautulliPython2Trakt/compare/v1.0.0...v1.1.0
[1.0.0]: https://github.com/TheGeeKing/TautulliPython2Trakt/releases/tag/v1.0.0
20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<h1 align="center">Tautulli Python 2 Trakt</h1>
</p>

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

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

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

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

**Name:** `TautulliPython2Trakt` **Redirect uri:** `urn:ietf:wg:oauth:2.0:oob` **Permissions:** `/scrobble`
**Name:** `TautulliPython2Trakt` \
**Redirect uri:** `urn:ietf:wg:oauth:2.0:oob` \
**Permissions:** `/scrobble`

Run the script:

Expand Down Expand Up @@ -80,7 +82,7 @@ If you want to collect your movies and TV shows, you need to do the Plex Media S
3. In the `Triggers` section, select `Recently Added`.
4. Put conditions if you want to, like media type, etc.
5. In the `Arguments` tab, put the following argument:
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>`
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>`

## Usage

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

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

Syncing behavior:

- 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.
- Based on the -PlexUser argument:
- (default behavior) `%OWNER%`, we sync the collections to the owner Trakt account.
- 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.
- 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.

## Similar Projects

Inspired from: https://github.com/frugglehost/TautulliBatch2Trakt
Expand Down
8 changes: 3 additions & 5 deletions TautulliPython2Trakt.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from dotenv import load_dotenv, set_key
from plexapi.myplex import MyPlexAccount

from utilities import ProgressBar, log, get_from_env
from utilities import ProgressBar, get_from_env, log

args = sys.argv[1:]

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

NUMBER_OF_ARGS = len(args)

arguments_string = ""
arguments_list = []
if args[0] == "-m":
SCROBBLE = True
Expand All @@ -340,15 +339,14 @@ def less_month_expiration_token_users(data):
next_arg = args[i + 1] if i + 1 < NUMBER_OF_ARGS else ""
if " " in next_arg:
next_arg = f'"{next_arg}"'
arguments_string += f"{current_arg} {next_arg} "
arguments_list += [current_arg, next_arg]
i += 2
else:
i += 1
else:
SCROBBLE = False

log(f"ARGUMENTS: {arguments_string}")
log(f"ARGUMENTS: {args}")

log(f"SCROBBLE: {SCROBBLE}")
if SCROBBLE:
Expand Down
1 change: 0 additions & 1 deletion scrobble.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import json
import os
import sys
import time

Expand Down
Loading

0 comments on commit d1ee90e

Please sign in to comment.