Bugfix: JellyfinAPI validation && Update sample config
This commit is contained in:
parent
f9681e35f4
commit
82b89ff808
|
@ -32,3 +32,8 @@ configuration = loadCFG(CFG_PATH)
|
|||
dirParser, JellyfinConfig = loadParser(configuration)
|
||||
DBPath = configuration["Main"]["DBPath"]
|
||||
tmpDir = configuration["Main"]["TMPDir"]
|
||||
qbit = {
|
||||
"login": configuration["QBitConfig"]["Username"],
|
||||
"pass": configuration["QBitConfig"]["Password"],
|
||||
"url": configuration["QBitConfig"]["ServerURL"]
|
||||
}
|
||||
|
|
|
@ -32,8 +32,11 @@ class Jellyfin(DirectoryGetter):
|
|||
raise Exception("Error connecting to JellyfinAPI")
|
||||
|
||||
def validation(self) -> bool:
|
||||
if self.__get("Library/VirtualFolders").status_code == 200:
|
||||
return True
|
||||
try:
|
||||
if self.__get("System/Info").json()["Id"] is not None:
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
|
||||
def __get(self, api_path: str) -> Response:
|
||||
request = req_get(f"{self.url}/{api_path}?api_key={self.api_key}")
|
||||
|
|
|
@ -5,6 +5,12 @@
|
|||
"TMPDir": "/tmp/qbitbot"
|
||||
},
|
||||
|
||||
"QBitConfig": {
|
||||
"ServerURL": "https://yourdomain.com",
|
||||
"Username": "youractualusername",
|
||||
"Password": "youractualpassword"
|
||||
},
|
||||
|
||||
"JellyfinConfig": {
|
||||
"ServerURL": "https://yourdomain.com",
|
||||
"APIKey": "youaractualjellyfintoken"
|
||||
|
|
Reference in New Issue