Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
991355716d | ||
|
|
54bd6e836f | ||
|
|
57c41f41bc | ||
|
|
ea85a31d9c | ||
|
|
80d5c9e54c | ||
|
|
5828701944 |
13
README.md
13
README.md
@@ -48,20 +48,14 @@ Full list of configuration options can be found in the [.env.sample](.env.sample
|
|||||||
|
|
||||||
### Baremetal
|
### Baremetal
|
||||||
|
|
||||||
- Setup virtualenv of your choice
|
- [Install uv](https://docs.astral.sh/uv/getting-started/installation/)
|
||||||
|
|
||||||
- Install dependencies
|
- Create a .env file similar to .env.sample; fill in baseurls and tokens, **remember to uncomment anything you wish to use** (e.g., user mapping, library mapping, black/whitelist, etc.)
|
||||||
|
|
||||||
```bash
|
|
||||||
pip install -r requirements.txt
|
|
||||||
```
|
|
||||||
|
|
||||||
- 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
|
uv run main.py
|
||||||
```
|
```
|
||||||
|
|
||||||
### Docker
|
### Docker
|
||||||
@@ -104,6 +98,7 @@ Full list of configuration options can be found in the [.env.sample](.env.sample
|
|||||||
|
|
||||||
- Configuration
|
- Configuration
|
||||||
- Do not use quotes around variables in docker compose
|
- Do not use quotes around variables in docker compose
|
||||||
|
- If you are not running all 3 supported servers, that is, Plex, Jellyfin, and Emby simultaneously, make sure to comment out the server url and token of the server you aren't using.
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
|||||||
@@ -201,8 +201,8 @@ def main_loop():
|
|||||||
server_2_watched = server_2.get_watched(server_2_users, server_2_libraries)
|
server_2_watched = server_2.get_watched(server_2_users, server_2_libraries)
|
||||||
logger.info("Finished creating watched list server 2")
|
logger.info("Finished creating watched list server 2")
|
||||||
|
|
||||||
logger.debug(f"Server 1 watched: {server_1_watched}")
|
logger.trace(f"Server 1 watched: {server_1_watched}")
|
||||||
logger.debug(f"Server 2 watched: {server_2_watched}")
|
logger.trace(f"Server 2 watched: {server_2_watched}")
|
||||||
|
|
||||||
logger.info("Cleaning Server 1 Watched", 1)
|
logger.info("Cleaning Server 1 Watched", 1)
|
||||||
server_1_watched_filtered = cleanup_watched(
|
server_1_watched_filtered = cleanup_watched(
|
||||||
|
|||||||
21
src/plex.py
21
src/plex.py
@@ -281,7 +281,9 @@ class Plex:
|
|||||||
output = {}
|
output = {}
|
||||||
|
|
||||||
libraries = self.plex.library.sections()
|
libraries = self.plex.library.sections()
|
||||||
logger.debug(f"Plex: All Libraries {[library.title for library in libraries]}")
|
logger.debug(
|
||||||
|
f"Plex: All Libraries {[library.title for library in libraries]}"
|
||||||
|
)
|
||||||
|
|
||||||
for library in libraries:
|
for library in libraries:
|
||||||
library_title = library.title
|
library_title = library.title
|
||||||
@@ -300,8 +302,7 @@ class Plex:
|
|||||||
logger.error(f"Plex: Failed to get libraries, Error: {e}")
|
logger.error(f"Plex: Failed to get libraries, Error: {e}")
|
||||||
raise Exception(e)
|
raise Exception(e)
|
||||||
|
|
||||||
def get_user_library_watched(self, user, user_plex, library) -> LibraryData:
|
def get_user_library_watched(self, user_name, user_plex, library) -> LibraryData:
|
||||||
user_name: str = user.username.lower() if user.username else user.title.lower()
|
|
||||||
try:
|
try:
|
||||||
logger.info(
|
logger.info(
|
||||||
f"Plex: Generating watched for {user_name} in library {library.title}",
|
f"Plex: Generating watched for {user_name} in library {library.title}",
|
||||||
@@ -388,6 +389,10 @@ class Plex:
|
|||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
user_name: str = (
|
||||||
|
user.username.lower() if user.username else user.title.lower()
|
||||||
|
)
|
||||||
|
|
||||||
libraries = user_plex.library.sections()
|
libraries = user_plex.library.sections()
|
||||||
|
|
||||||
for library in libraries:
|
for library in libraries:
|
||||||
@@ -395,15 +400,13 @@ class Plex:
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
library_data = self.get_user_library_watched(
|
library_data = self.get_user_library_watched(
|
||||||
user, user_plex, library
|
user_name, user_plex, library
|
||||||
)
|
)
|
||||||
|
|
||||||
if user.title.lower() not in users_watched:
|
if user_name not in users_watched:
|
||||||
users_watched[user.title.lower()] = UserData()
|
users_watched[user_name] = UserData()
|
||||||
|
|
||||||
users_watched[user.title.lower()].libraries[library.title] = (
|
users_watched[user_name].libraries[library.title] = library_data
|
||||||
library_data
|
|
||||||
)
|
|
||||||
|
|
||||||
return users_watched
|
return users_watched
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user