Jellyfin Login ✓
This commit is contained in:
@@ -35,11 +35,13 @@ class Jellyfin(object):
|
||||
PRODUCT, RELEASE, PRODUCT, jellypy.CONFIG.JELLYFIN_CLIENT_UUID
|
||||
)
|
||||
self.jf.config.data["http.user_agent"] = PRODUCT
|
||||
self.jf.config.data["auth.ssl"] = not jellypy.CONFIG.JELLYFIN_SSL
|
||||
self.jf.config.data["auth.ssl"] = jellypy.CONFIG.JELLYFIN_SSL
|
||||
self.url = url
|
||||
self.id = None
|
||||
self.token = token
|
||||
|
||||
if token:
|
||||
self.login(token=token)
|
||||
if self.token:
|
||||
self.login()
|
||||
|
||||
def get_library(self, section_id):
|
||||
return self.jf.library.sectionByID(str(section_id))
|
||||
@@ -50,22 +52,23 @@ class Jellyfin(object):
|
||||
def get_item(self, rating_key):
|
||||
return self.jf.fetchItem(rating_key)
|
||||
|
||||
def login(self, user=None, password=None, token=None) -> bool:
|
||||
if user and password:
|
||||
def login(self, user=None, password=None) -> bool:
|
||||
if user and password and self.url:
|
||||
self.jf.auth.connect_to_address(self.url)
|
||||
result = self.jf.auth.login(self.url, user, password)
|
||||
|
||||
if "AccessToken" in result:
|
||||
credentials = self.jf.auth.credentials.get_credentials()
|
||||
pprint.pprint(credentials)
|
||||
server = credentials["Servers"][0]
|
||||
server["uuid"] = server["Id"]
|
||||
server["username"] = user
|
||||
|
||||
self.id = credentials["Servers"][0]["Id"]
|
||||
# jellypy.CONFIG.JELLYFIN_TOKEN =
|
||||
#
|
||||
# self._connect_client(server)
|
||||
# self.credentials.append(server)
|
||||
# self.save_credentials()
|
||||
return True
|
||||
return False
|
||||
if self.token and self.url:
|
||||
# TODO: Add token auth
|
||||
pass
|
||||
|
||||
return False
|
||||
|
Reference in New Issue
Block a user