From: Christian Heller Date: Sun, 24 Nov 2024 23:21:18 +0000 (+0100) Subject: Ensure thumbnail directory exists when retrieving on query. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/%7B%7Bprefix%7D%7D/%7B%7Bdb.prefix%7D%7D/do_tasks?a=commitdiff_plain;h=09ffa53a322eacaaa624ffe64447952ffd48f6ad;p=ytplom Ensure thumbnail directory exists when retrieving on query. --- diff --git a/install_to_share/ytplom/misc.py b/install_to_share/ytplom/misc.py index 647ad39..0c2777e 100644 --- a/install_to_share/ytplom/misc.py +++ b/install_to_share/ytplom/misc.py @@ -83,7 +83,7 @@ QUOTA_COST_YOUTUBE_DETAILS = QuotaCost(1) TIMESTAMP_FMT = '%Y-%m-%d %H:%M:%S.%f' LEGAL_EXTENSIONS = {'webm', 'mp4', 'mkv'} -# tables to create database with +# database stuff EXPECTED_DB_VERSION = 0 SQL_DB_VERSION = SqlText('PRAGMA user_version') PATH_MIGRATIONS = PathStr(path_join(PATH_APP_DATA, 'migrations')) @@ -91,7 +91,7 @@ PATH_DB_SCHEMA = PathStr(path_join(PATH_MIGRATIONS, f'init_{EXPECTED_DB_VERSION}.sql')) # other -NAME_INSTALLER = 'install.sh' +NAME_INSTALLER = PathStr('install.sh') VIDEO_FLAGS: dict[FlagName, FlagsInt] = { FlagName('delete'): FlagsInt(1 << 62) } @@ -658,6 +658,7 @@ class TaskHandler(BaseHTTPRequestHandler): conn = DatabaseConnection() def collect_results(query_txt: QueryText) -> list[YoutubeVideo]: + _ensure_expected_dirs([PATH_THUMBNAILS]) youtube = googleapiclient.discovery.build('youtube', 'v3', developerKey=API_KEY) QuotaLog.update(conn, QUOTA_COST_YOUTUBE_SEARCH)