Merge pull request #228 from luigi311/misc

Misc
pull/230/head
Luigi311 2025-02-21 14:54:10 -07:00 committed by GitHub
commit 8f4a2e2690
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 31 additions and 35 deletions

4
.vscode/launch.json vendored
View File

@ -6,7 +6,7 @@
"configurations": [
{
"name": "Python: Main",
"type": "python",
"type": "debugpy",
"request": "launch",
"program": "main.py",
"console": "integratedTerminal",
@ -14,7 +14,7 @@
},
{
"name": "Pytest",
"type": "python",
"type": "debugpy",
"request": "launch",
"module": "pytest",
"args": [

View File

@ -1,9 +1,9 @@
import sys
if __name__ == "__main__":
# Check python version 3.9 or higher
if not (3, 9) <= tuple(map(int, sys.version_info[:2])):
print("This script requires Python 3.9 or higher")
# Check python version 3.12 or higher
if not (3, 12) <= tuple(map(int, sys.version_info[:2])):
print("This script requires Python 3.12 or higher")
sys.exit(1)
from src.main import main

View File

@ -1,6 +1,7 @@
# Functions for Jellyfin and Emby
import traceback, os
import traceback
import os
from math import floor
from typing import Any, Literal
from dotenv import load_dotenv
@ -210,32 +211,17 @@ class JellyfinEmby:
for _, user_id in users.items():
user_libraries: dict = self.query(f"/Users/{user_id}/Views", "get")
for library in user_libraries["Items"]:
library_id = library["Id"]
library_title = library["Name"]
library_type = library.get("CollectionType")
# Get library items to check the type
media_info = self.query(
f"/Users/{user_id}/Items"
+ f"?ParentId={library_id}&Filters=IsPlayed&Recursive=True&excludeItemTypes=Folder&limit=100",
"get",
)
types = set(
[
x["Type"]
for x in media_info["Items"]
if x["Type"] in ["Movie", "Series", "Episode"]
]
)
all_types = set([x["Type"] for x in media_info["Items"]])
if not types:
if library_type not in ["movies", "tvshows"]:
logger(
f"{self.server_type}: Skipping Library {library_title} found wanted types: {all_types}",
f"{self.server_type}: Skipping Library {library_title} found type {library_type}",
1,
)
else:
libraries[library_title] = str(types)
continue
libraries[library_title] = library_type
return libraries
except Exception as e:
@ -427,9 +413,9 @@ class JellyfinEmby:
if user_name.lower() not in users_watched:
users_watched[user_name.lower()] = UserData()
users_watched[user_name.lower()].libraries[
library_title
] = library_data
users_watched[user_name.lower()].libraries[library_title] = (
library_data
)
return users_watched
except Exception as e:

View File

@ -1,4 +1,6 @@
import os, traceback, json
import os
import traceback
import json
from dotenv import load_dotenv
from time import sleep, perf_counter

View File

@ -1,4 +1,5 @@
import os, requests
import os
import requests
from dotenv import load_dotenv
from urllib3.poolmanager import PoolManager
@ -286,6 +287,13 @@ class Plex:
library_title = library.title
library_type = library.type
if library_type not in ["movie", "show"]:
logger(
f"Plex: Skipping Library {library_title} found type {library_type}",
1,
)
continue
output[library_title] = library_type
return output
@ -397,9 +405,9 @@ class Plex:
if user.title.lower() not in users_watched:
users_watched[user.title.lower()] = UserData()
users_watched[user.title.lower()].libraries[
library.title
] = library_data
users_watched[user.title.lower()].libraries[library.title] = (
library_data
)
return users_watched
except Exception as e: