From 3d592e05b14bcbe690dcef8ac50ea3f0b053c842 Mon Sep 17 00:00:00 2001 From: NikolajDanger Date: Wed, 18 Aug 2021 17:49:51 +0200 Subject: [PATCH] :bug: fixed downloading bug --- gwendolyn/funcs/other/plex.py | 18 ++++++++++++++---- gwendolyn/resources/starting_files.json | 2 +- gwendolyn/utils/util_functions.py | 2 ++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/gwendolyn/funcs/other/plex.py b/gwendolyn/funcs/other/plex.py index 953911d..dc534e2 100644 --- a/gwendolyn/funcs/other/plex.py +++ b/gwendolyn/funcs/other/plex.py @@ -281,7 +281,16 @@ class Plex(): message.append( dm_section_title_line+dm_section_title+dm_section_title_line ) - response = requests.get(self.qbittorrent_url+"torrents/info") + login_url = self.qbittorrent_url+"auth/login" + username = self.credentials["qbittorrent_username"] + password = self.credentials["qbittorrent_password"] + login_url += f"?username={username}&password={password}" + cookie = {"SID": requests.get(login_url).cookies.values()[0]} + + response = requests.get( + self.qbittorrent_url+"torrents/info", + cookies=cookie + ) torrent_list = response.json() if len(torrent_list) > 0: @@ -353,10 +362,11 @@ class Plex(): movies_section_line+movies_section_title+movies_section_line ) movie_list = requests.get( - self.radarr_url+"movie?api_key="+self.credentials["radarr_key"] + self.radarr_url+"movie?apiKey="+self.credentials["radarr_key"] ).json() + print(self.radarr_url+"movie?apiKey="+self.credentials["radarr_key"]) movie_queue = requests.get( - self.radarr_url+"queue?api_key="+self.credentials["radarr_key"] + self.radarr_url+"queue?apiKey="+self.credentials["radarr_key"] ).json() movie_queue_ids = [] @@ -394,7 +404,7 @@ class Plex(): ) show_list = requests.get( - self.sonarr_url+"series?api_key="+self.credentials["sonarr_key"] + self.sonarr_url+"series?apiKey="+self.credentials["sonarr_key"] ).json() for show in show_list: diff --git a/gwendolyn/resources/starting_files.json b/gwendolyn/resources/starting_files.json index 78affaa..1495f31 100644 --- a/gwendolyn/resources/starting_files.json +++ b/gwendolyn/resources/starting_files.json @@ -59,7 +59,7 @@ "gwendolyn/resources/star_wars/destinyPoints.txt": "", "gwendolyn/resources/movies.txt": "The Room", "gwendolyn/resources/names.txt": "Gandalf\n", - "credentials.txt" : "Bot token: TOKEN\nFinnhub API key: KEY\nWordnik API Key: KEY\nMongoDB user: USERNAME\nMongoDB password: PASSWORD\nWolframAlpha AppID: APPID\nRadarr API key: KEY\nSonarr API key: KEY", + "credentials.txt" : "Bot token: TOKEN\nFinnhub API key: KEY\nWordnik API Key: KEY\nMongoDB user: USERNAME\nMongoDB password: PASSWORD\nWolframAlpha AppID: APPID\nRadarr API key: KEY\nSonarr API key: KEY\nqBittorrent username: USER\nqBittorrent password: PASSWORD", "options.txt" : "Testing: True\nTesting guild ids:\nAdmins:" }, "folder" : [ diff --git a/gwendolyn/utils/util_functions.py b/gwendolyn/utils/util_functions.py index d6f62b3..167e309 100644 --- a/gwendolyn/utils/util_functions.py +++ b/gwendolyn/utils/util_functions.py @@ -130,6 +130,8 @@ def get_credentials(): credentials["wolfram_alpha_key"] = data["wolframalpha appid"] credentials["radarr_key"] = data["radarr api key"] credentials["sonarr_key"] = data["sonarr api key"] + credentials["qbittorrent_username"] = data["qbittorrent username"] + credentials["qbittorrent_password"] = data["qbittorrent password"] return credentials