configure client in utils method
This commit is contained in:
@@ -10,23 +10,24 @@ import time
|
||||
class JellyfinApiClient:
|
||||
"""
|
||||
Client for interacting with the Jellyfin server API.
|
||||
|
||||
Attributes:
|
||||
last_auth_time (Optional[float]): Timestamp of the last authentication.
|
||||
logger (logging.Logger): Logger instance for logging messages.
|
||||
"""
|
||||
last_auth_time: Optional[float] = None
|
||||
logger: logging.Logger = logging.getLogger('JellyfinApiClient')
|
||||
|
||||
def __init__(self):
|
||||
"""
|
||||
Initializes the Jellyfin API client and authenticates with the server.
|
||||
"""
|
||||
self.logger = logging.getLogger('JellyfinApiClient')
|
||||
|
||||
self.logger.info("Connecting to Jellyfin server...")
|
||||
|
||||
self.client = JellyfinClient()
|
||||
self.client.config.app('jellydisc', '0.1.2', JellyfinUtils.get_machine_name(), JellyfinUtils.get_unique_id())
|
||||
self.client.config.data['auth.ssl'] = settings.jellyfin_server_url.startswith(
|
||||
'https://')
|
||||
JellyfinUtils.configure_client(self.client)
|
||||
|
||||
self.last_auth_time = None
|
||||
self.authenticate()
|
||||
|
||||
self.logger.info("Connected to Jellyfin server.")
|
||||
|
||||
def authenticate(self):
|
||||
|
||||
Reference in New Issue
Block a user