pull/65/head
Luigi311 2023-04-11 08:48:30 -06:00
parent 58337bd38c
commit 4870ff9e7a
3 changed files with 185 additions and 182 deletions

View File

@ -1,6 +1,6 @@
# JellyPlex-Watched # JellyPlex-Watched
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/26b47c5db63942f28f02f207f692dc85)](https://www.codacy.com/gh/luigi311/JellyPlex-Watched/dashboard?utm_source=github.com&utm_medium=referral&utm_content=luigi311/JellyPlex-Watched&utm_campaign=Badge_Grade) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/26b47c5db63942f28f02f207f692dc85)](https://www.codacy.com/gh/luigi311/JellyPlex-Watched/dashboard?utm_source=github.com\&utm_medium=referral\&utm_content=luigi311/JellyPlex-Watched\&utm_campaign=Badge_Grade)
Sync watched between jellyfin and plex locally Sync watched between jellyfin and plex locally
@ -11,31 +11,34 @@ Keep in sync all your users watched history between jellyfin and plex servers lo
## Features ## Features
### Plex ### Plex
- [x] Match via Filenames
- [x] Match via provider ids * \[x] Match via Filenames
- [x] Map usersnames * \[x] Match via provider ids
- [x] Use single login * \[x] Map usersnames
- [x] One Way/Multi Way sync * \[x] Use single login
- [x] Sync Watched * \[x] One Way/Multi Way sync
- [x] Sync Inprogress * \[x] Sync Watched
* \[x] Sync Inprogress
### Jellyfin ### Jellyfin
- [x] Match via Filenames
- [x] Match via provider ids * \[x] Match via Filenames
- [x] Map usersnames * \[x] Match via provider ids
- [x] Use single login * \[x] Map usersnames
- [x] One Way/Multi Way sync * \[x] Use single login
- [x] Sync Watched * \[x] One Way/Multi Way sync
- [ ] Sync Inprogress * \[x] Sync Watched
* \[ ] Sync Inprogress
### Emby ### Emby
- [ ] Match via Filenames
- [ ] Match via provider ids * \[ ] Match via Filenames
- [ ] Map usersnames * \[ ] Match via provider ids
- [ ] Use single login * \[ ] Map usersnames
- [ ] One Way/Multi Way sync * \[ ] Use single login
- [ ] Sync Watched * \[ ] One Way/Multi Way sync
- [ ] Sync Inprogress * \[ ] Sync Watched
* \[ ] Sync Inprogress
## Configuration ## Configuration
@ -51,6 +54,9 @@ DEBUG = "False"
## Debugging level, "info" is default, "debug" is more verbose ## Debugging level, "info" is default, "debug" is more verbose
DEBUG_LEVEL = "info" DEBUG_LEVEL = "info"
## If set to true then the script will only run once and then exit
RUN_ONLY_ONCE = "False"
## How often to run the script in seconds ## How often to run the script in seconds
SLEEP_DURATION = "3600" SLEEP_DURATION = "3600"
@ -121,17 +127,17 @@ JELLYFIN_TOKEN = "SuperSecretToken, SuperSecretToken2"
### Baremetal ### Baremetal
- Setup virtualenv of your choice * Setup virtualenv of your choice
- Install dependencies * Install dependencies
```bash ```bash
pip install -r requirements.txt pip install -r requirements.txt
``` ```
- Create a .env file similar to .env.sample, uncomment whitelist and blacklist if needed, fill in baseurls and tokens * Create a .env file similar to .env.sample, uncomment whitelist and blacklist if needed, fill in baseurls and tokens
- Run * Run
```bash ```bash
python main.py python main.py
@ -139,13 +145,13 @@ JELLYFIN_TOKEN = "SuperSecretToken, SuperSecretToken2"
### Docker ### Docker
- Build docker image * Build docker image
```bash ```bash
docker build -t jellyplex-watched . docker build -t jellyplex-watched .
``` ```
- or use pre-built image * or use pre-built image
```bash ```bash
docker pull luigi311/jellyplex-watched:latest docker pull luigi311/jellyplex-watched:latest
@ -153,7 +159,7 @@ JELLYFIN_TOKEN = "SuperSecretToken, SuperSecretToken2"
#### With variables #### With variables
- Run * Run
```bash ```bash
docker run --rm -it -e PLEX_TOKEN='SuperSecretToken' luigi311/jellyplex-watched:latest docker run --rm -it -e PLEX_TOKEN='SuperSecretToken' luigi311/jellyplex-watched:latest
@ -161,9 +167,9 @@ JELLYFIN_TOKEN = "SuperSecretToken, SuperSecretToken2"
#### With .env #### With .env
- Create a .env file similar to .env.sample and set the variables to match your setup * Create a .env file similar to .env.sample and set the variables to match your setup
- Run * Run
```bash ```bash
docker run --rm -it -v "$(pwd)/.env:/app/.env" luigi311/jellyplex-watched:latest docker run --rm -it -v "$(pwd)/.env:/app/.env" luigi311/jellyplex-watched:latest

View File

@ -591,8 +591,8 @@ class Jellyfin:
break break
if movie_status: if movie_status:
if movie_status["completed"]:
jellyfin_video_id = jellyfin_video["Id"] jellyfin_video_id = jellyfin_video["Id"]
if movie_status["completed"]:
msg = f"{jellyfin_video['Name']} as watched for {user_name} in {library} for Jellyfin" msg = f"{jellyfin_video['Name']} as watched for {user_name} in {library} for Jellyfin"
if not dryrun: if not dryrun:
logger(f"Marking {msg}", 0) logger(f"Marking {msg}", 0)
@ -605,7 +605,6 @@ class Jellyfin:
logger(f"Dryrun {msg}", 0) logger(f"Dryrun {msg}", 0)
else: else:
# TODO add support for partially watched movies # TODO add support for partially watched movies
jellyfin_video_id = jellyfin_video["Id"]
msg = f"{jellyfin_video['Name']} as partially watched for {floor(movie_status['time'] / 60_000)} minutes for {user_name} in {library} for Jellyfin" msg = f"{jellyfin_video['Name']} as partially watched for {floor(movie_status['time'] / 60_000)} minutes for {user_name} in {library} for Jellyfin"
if not dryrun: if not dryrun:
pass pass

View File

@ -174,10 +174,8 @@ def episode_title_dict(user_list: dict):
for show in user_list: for show in user_list:
for season in user_list[show]: for season in user_list[show]:
for episode in user_list[show][season]: for episode in user_list[show][season]:
# Iterate through the keys and values in each episode # Iterate through the keys and values in each episode
for episode_key, episode_value in episode.items(): for episode_key, episode_value in episode.items():
# If the key is not "status", add the key to episode_output_dict if it doesn't exist # If the key is not "status", add the key to episode_output_dict if it doesn't exist
if episode_key != "status": if episode_key != "status":
if episode_key.lower() not in episode_output_dict: if episode_key.lower() not in episode_output_dict: