6 Commits

Author SHA1 Message Date
Luigi311
991355716d Merge pull request #240 from luigi311/user_name
Plex: Use username for watch key if exists
2025-02-26 15:48:32 -07:00
Luis Garcia
54bd6e836f Plex: Use username for watch key if exists
Signed-off-by: Luis Garcia <git@luigi311.com>
2025-02-26 22:46:16 +00:00
Luigi311
57c41f41bc Merge pull request #244 from luigi311/watched_trace
Move server watched log to trace
2025-02-26 13:27:09 -07:00
Luis Garcia
ea85a31d9c Move server watched log to trace
Signed-off-by: Luis Garcia <git@luigi311.com>
2025-02-26 20:23:40 +00:00
Luigi311
80d5c9e54c Merge pull request #242 from BadCoder2/patch-1
Update README.md to reflect uv update; make environment setting more clear
2025-02-25 23:05:30 -07:00
Nathan Hoffman
5828701944 Update README.md to uv; make environment setting more clear 2025-02-25 23:44:26 -06:00
3 changed files with 18 additions and 20 deletions

View File

@@ -48,20 +48,14 @@ Full list of configuration options can be found in the [.env.sample](.env.sample
### Baremetal
- Setup virtualenv of your choice
- [Install uv](https://docs.astral.sh/uv/getting-started/installation/)
- Install dependencies
```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
- 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.)
- Run
```bash
python main.py
uv run main.py
```
### Docker
@@ -104,6 +98,7 @@ Full list of configuration options can be found in the [.env.sample](.env.sample
- Configuration
- 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

View File

@@ -201,8 +201,8 @@ def main_loop():
server_2_watched = server_2.get_watched(server_2_users, server_2_libraries)
logger.info("Finished creating watched list server 2")
logger.debug(f"Server 1 watched: {server_1_watched}")
logger.debug(f"Server 2 watched: {server_2_watched}")
logger.trace(f"Server 1 watched: {server_1_watched}")
logger.trace(f"Server 2 watched: {server_2_watched}")
logger.info("Cleaning Server 1 Watched", 1)
server_1_watched_filtered = cleanup_watched(

View File

@@ -281,7 +281,9 @@ class Plex:
output = {}
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:
library_title = library.title
@@ -300,8 +302,7 @@ class Plex:
logger.error(f"Plex: Failed to get libraries, Error: {e}")
raise Exception(e)
def get_user_library_watched(self, user, user_plex, library) -> LibraryData:
user_name: str = user.username.lower() if user.username else user.title.lower()
def get_user_library_watched(self, user_name, user_plex, library) -> LibraryData:
try:
logger.info(
f"Plex: Generating watched for {user_name} in library {library.title}",
@@ -388,6 +389,10 @@ class Plex:
)
continue
user_name: str = (
user.username.lower() if user.username else user.title.lower()
)
libraries = user_plex.library.sections()
for library in libraries:
@@ -395,15 +400,13 @@ class Plex:
continue
library_data = self.get_user_library_watched(
user, user_plex, library
user_name, user_plex, library
)
if user.title.lower() not in users_watched:
users_watched[user.title.lower()] = UserData()
if user_name not in users_watched:
users_watched[user_name] = UserData()
users_watched[user.title.lower()].libraries[library.title] = (
library_data
)
users_watched[user_name].libraries[library.title] = library_data
return users_watched
except Exception as e: