cleanup cookie file after task
This commit is contained in:
parent
087043811f
commit
3722f11a65
|
@ -145,6 +145,16 @@ class PendingList(PendingIndex):
|
||||||
cookie_path = CookieHandler().use()
|
cookie_path = CookieHandler().use()
|
||||||
self.yt_obs.update({"cookiefile": cookie_path})
|
self.yt_obs.update({"cookiefile": cookie_path})
|
||||||
|
|
||||||
|
def close_config(self):
|
||||||
|
"""remove config after task finished"""
|
||||||
|
config = AppConfig().config
|
||||||
|
if config["downloads"]["cookie_import"]:
|
||||||
|
CookieHandler().hide()
|
||||||
|
try:
|
||||||
|
del self.yt_obs["cookiefile"]
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
def parse_url_list(self):
|
def parse_url_list(self):
|
||||||
"""extract youtube ids from list"""
|
"""extract youtube ids from list"""
|
||||||
self.missing_videos = []
|
self.missing_videos = []
|
||||||
|
@ -225,6 +235,8 @@ class PendingList(PendingIndex):
|
||||||
query_str = "\n".join(bulk_list)
|
query_str = "\n".join(bulk_list)
|
||||||
_, _ = ElasticWrap("_bulk").post(query_str, ndjson=True)
|
_, _ = ElasticWrap("_bulk").post(query_str, ndjson=True)
|
||||||
|
|
||||||
|
self.close_config()
|
||||||
|
|
||||||
def _notify_add(self, idx):
|
def _notify_add(self, idx):
|
||||||
"""send notification for adding videos to download queue"""
|
"""send notification for adding videos to download queue"""
|
||||||
progress = f"{idx + 1}/{len(self.missing_videos)}"
|
progress = f"{idx + 1}/{len(self.missing_videos)}"
|
||||||
|
|
|
@ -41,7 +41,7 @@ class DownloadPostProcess:
|
||||||
self.auto_delete_all()
|
self.auto_delete_all()
|
||||||
self.auto_delete_overwrites()
|
self.auto_delete_overwrites()
|
||||||
self.validate_playlists()
|
self.validate_playlists()
|
||||||
self.clear_cookie()
|
self.pending.close_config()
|
||||||
|
|
||||||
def auto_delete_all(self):
|
def auto_delete_all(self):
|
||||||
"""handle auto delete"""
|
"""handle auto delete"""
|
||||||
|
@ -141,11 +141,6 @@ class DownloadPostProcess:
|
||||||
else:
|
else:
|
||||||
RedisArchivist().set_message("message:download", mess_dict)
|
RedisArchivist().set_message("message:download", mess_dict)
|
||||||
|
|
||||||
def clear_cookie(self):
|
|
||||||
"""hide cookie file"""
|
|
||||||
if self.download.config["downloads"]["cookie_import"]:
|
|
||||||
CookieHandler().hide()
|
|
||||||
|
|
||||||
|
|
||||||
class VideoDownloader:
|
class VideoDownloader:
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue