From 499c47c7a11b5997f3e504e31433706e9551dd2c Mon Sep 17 00:00:00 2001 From: simon Date: Tue, 21 Jun 2022 08:01:33 +0700 Subject: [PATCH] move set_cookie to separate method for reusabliity --- tubearchivist/home/src/download/yt_dlp_base.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tubearchivist/home/src/download/yt_dlp_base.py b/tubearchivist/home/src/download/yt_dlp_base.py index b8d9aa3..df929f5 100644 --- a/tubearchivist/home/src/download/yt_dlp_base.py +++ b/tubearchivist/home/src/download/yt_dlp_base.py @@ -85,11 +85,19 @@ class CookieHandler: with open(import_path, encoding="utf-8") as cookie_file: cookie = cookie_file.read() - RedisArchivist().set_message("cookie", cookie) + self.set_cookie(cookie) os.remove(import_path) print("cookie: import successful") + def set_cookie(self, cookie): + """set cookie str and activate in cofig""" + RedisArchivist().set_message("cookie", cookie) + path = ".downloads.cookie_import" + RedisArchivist().set_message("config", True, path=path) + self.config["downloads"]["cookie_import"] = True + print("cookie: activated and stored in Redis") + @staticmethod def revoke(): """revoke cookie"""