hide cookie after rescan and download process

This commit is contained in:
simon 2022-05-03 17:32:32 +07:00
parent 83beb53860
commit 1613b71942
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
2 changed files with 16 additions and 3 deletions

View File

@ -41,6 +41,7 @@ class DownloadPostProcess:
self.auto_delete_all()
self.auto_delete_overwrites()
self.validate_playlists()
self.clear_cookie()
def auto_delete_all(self):
"""handle auto delete"""
@ -140,6 +141,11 @@ class DownloadPostProcess:
else:
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:
"""

View File

@ -12,6 +12,7 @@ import shutil
import subprocess
from home.src.download.queue import PendingList
from home.src.download.yt_cookie import CookieHandler
from home.src.download.yt_dlp_handler import VideoDownloader
from home.src.es.connect import ElasticWrap
from home.src.index.reindex import Reindex
@ -308,6 +309,12 @@ def scan_filesystem():
def reindex_old_documents():
"""daily refresh of old documents"""
handler = Reindex()
handler.check_outdated()
handler.reindex()
RedisArchivist().set_message("last_reindex", handler.now, expire=False)
if handler.config["downloads"]["cookie_import"]:
CookieHandler().use()
try:
handler.check_outdated()
handler.reindex()
RedisArchivist().set_message("last_reindex", handler.now, expire=False)
finally:
if handler.config["downloads"]["cookie_import"]:
CookieHandler().hide()