Files
UgPod/jelly.py
2025-12-27 00:14:03 +00:00

44 lines
1.2 KiB
Python

from jellyfin_apiclient_python import JellyfinClient
import os
from dotenv import load_dotenv
import json
load_dotenv()
# album_covers = {}
# client = JellyfinClient()
# client.config.app("UgPod", "0.0.1", "UgPod prototype", "UgPod_prototype_1")
# client.config.data["auth.ssl"] = True
# try:
# with open("data/auth.json", "r") as f:
# credentials = json.load(f)
# client.authenticate(credentials, discover=False)
# # 🔴 THIS IS THE MISSING STEP
# server = credentials["Servers"][0]
# client.config.data["auth.server"] = server["Id"]
# client.config.data["auth.servers"] = credentials["Servers"]
# client.start()
# server = credentials["Servers"][0]
# assert server["Address"].startswith("http")
# print("Server address:", server["Address"])
# print("Server ID:", server["Id"])
# except:
# print("authenticating")
# client.auth.connect_to_address(os.getenv("host"))
# client.auth.login(os.getenv("URL"), os.getenv("username"), os.getenv("password"))
# credentials = client.auth.credentials.get_credentials()
# # with open("data/auth.json", 'w') as f:
# # json.dump(credentials, f)
# server = credentials["Servers"][0]
client = None
server = None