4
1
Fork 1

Bugfix: JellyfinAPI validation && Update sample config

This commit is contained in:
trueold89 2024-05-09 18:32:50 +03:00
parent f9681e35f4
commit 82b89ff808
Signed by: trueold89
GPG Key ID: C122E85DD49E6B30
3 changed files with 16 additions and 2 deletions

View File

@ -32,3 +32,8 @@ configuration = loadCFG(CFG_PATH)
dirParser, JellyfinConfig = loadParser(configuration) dirParser, JellyfinConfig = loadParser(configuration)
DBPath = configuration["Main"]["DBPath"] DBPath = configuration["Main"]["DBPath"]
tmpDir = configuration["Main"]["TMPDir"] tmpDir = configuration["Main"]["TMPDir"]
qbit = {
"login": configuration["QBitConfig"]["Username"],
"pass": configuration["QBitConfig"]["Password"],
"url": configuration["QBitConfig"]["ServerURL"]
}

View File

@ -32,8 +32,11 @@ class Jellyfin(DirectoryGetter):
raise Exception("Error connecting to JellyfinAPI") raise Exception("Error connecting to JellyfinAPI")
def validation(self) -> bool: def validation(self) -> bool:
if self.__get("Library/VirtualFolders").status_code == 200: try:
return True if self.__get("System/Info").json()["Id"] is not None:
return True
except:
return False
def __get(self, api_path: str) -> Response: def __get(self, api_path: str) -> Response:
request = req_get(f"{self.url}/{api_path}?api_key={self.api_key}") request = req_get(f"{self.url}/{api_path}?api_key={self.api_key}")

View File

@ -5,6 +5,12 @@
"TMPDir": "/tmp/qbitbot" "TMPDir": "/tmp/qbitbot"
}, },
"QBitConfig": {
"ServerURL": "https://yourdomain.com",
"Username": "youractualusername",
"Password": "youractualpassword"
},
"JellyfinConfig": { "JellyfinConfig": {
"ServerURL": "https://yourdomain.com", "ServerURL": "https://yourdomain.com",
"APIKey": "youaractualjellyfintoken" "APIKey": "youaractualjellyfintoken"