summaryrefslogtreecommitdiff
path: root/raphodo/cache.py
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2017-10-02 06:51:13 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2017-10-02 06:51:13 +0200
commitc5fc6c6030d7d9d1b2af3d5165bebed3decd741b (patch)
treedfacccc9ae0747e53e53e5388b2ecd0623e040c3 /raphodo/cache.py
parent77dd64c0757c0191b276e65c24ee9874959790c8 (diff)
New upstream version 0.9.4upstream/0.9.4
Diffstat (limited to 'raphodo/cache.py')
-rw-r--r--raphodo/cache.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/raphodo/cache.py b/raphodo/cache.py
index f1854d6..0801762 100644
--- a/raphodo/cache.py
+++ b/raphodo/cache.py
@@ -370,7 +370,7 @@ class ThumbnailCacheSql:
not_found = GetThumbnailPath(ThumbnailCacheDiskStatus.not_found, None, None, None)
- def __init__(self):
+ def __init__(self, create_table_if_not_exists: bool) -> None:
self.cache_dir = get_program_cache_directory(create_if_not_exist=True)
self.valid = self.cache_dir is not None
if not self.valid:
@@ -388,8 +388,9 @@ class ThumbnailCacheSql:
os.makedirs(self.cache_dir, 0o700)
logging.debug("Created thumbnails cache %s", self.cache_dir)
except:
- logging.error("Failed to create Rapid Photo Downloader Thumbnail Cache at %s",
- self.cache_dir)
+ logging.error(
+ "Failed to create Rapid Photo Downloader Thumbnail Cache at %s", self.cache_dir
+ )
self.valid = False
self.cache_dir = None
self.random_filename = None
@@ -397,7 +398,7 @@ class ThumbnailCacheSql:
else:
self.random_filename = GenerateRandomFileName()
self.md5 = MD5Name()
- self.thumb_db = CacheSQL(self.cache_dir)
+ self.thumb_db = CacheSQL(self.cache_dir, create_table_if_not_exists)
def save_thumbnail(self, full_file_name: str, size: int,
mtime: float,
@@ -598,5 +599,5 @@ class ThumbnailCacheSql:
if __name__ == '__main__':
- db = ThumbnailCacheSql()
+ db = ThumbnailCacheSql(create_table_if_not_exists=True)
db.optimize() \ No newline at end of file