38 lines
992 B
Python
38 lines
992 B
Python
from jellyfin_apiclient_python import JellyfinClient
|
|
from getmac import get_mac_address
|
|
from settings import settings
|
|
import os
|
|
|
|
|
|
class JellyfinUtils:
|
|
@staticmethod
|
|
def configure_client(client: JellyfinClient):
|
|
client.config.app(
|
|
settings.app_name,
|
|
settings.app_version,
|
|
JellyfinUtils.get_machine_name(),
|
|
JellyfinUtils.get_unique_id()
|
|
)
|
|
client.config.data['auth.ssl'] = settings.jellyfin_server_url.startswith(
|
|
'https://')
|
|
|
|
@staticmethod
|
|
def get_machine_name() -> str:
|
|
"""
|
|
Retrieves the machine name of the current host.
|
|
|
|
Returns:
|
|
str: The machine name.
|
|
"""
|
|
return os.uname().nodename
|
|
|
|
@staticmethod
|
|
def get_unique_id() -> str:
|
|
"""
|
|
Retrieves the MAC address of the localhost as a unique identifier.
|
|
|
|
Returns:
|
|
str: The MAC address.
|
|
"""
|
|
return get_mac_address(hostname="localhost")
|