home · contact · privacy
Ensure thumbnail directory exists when retrieving on query. master
authorChristian Heller <c.heller@plomlompom.de>
Sun, 24 Nov 2024 23:21:18 +0000 (00:21 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Sun, 24 Nov 2024 23:21:18 +0000 (00:21 +0100)
install_to_share/ytplom/misc.py

index 647ad3901c98a5b924d47c3ea124924ad711e83b..0c2777ec939557485da6bea96e8b4b8a649d0f15 100644 (file)
@@ -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)