summaryrefslogtreecommitdiff
path: root/raphodo/cache.py
diff options
context:
space:
mode:
authorAntoine Beaupré <anarcat@debian.org>2018-07-30 10:50:18 -0400
committerAntoine Beaupré <anarcat@debian.org>2018-07-30 10:50:18 -0400
commit8b136df8c340d1e1ee1874ef60850aa9bd153d49 (patch)
tree79224158005471028278eb4ddd66a73a2e43294c /raphodo/cache.py
parente93ead0a34c25ef37904e0dc9634cdd045f05e64 (diff)
parentbaec34cc51c5822c002b22072a9e99d662dce465 (diff)
Merge tag 'upstream/0.9.10'HEADmaster
Upstream version 0.9.10 # gpg: Signature faite le lun 30 jui 2018 10:50:17 EDT # gpg: avec la clef RSA 7B164204D096723B019635AB3EA1DDDDB261D97B # gpg: Bonne signature de « Antoine Beaupré <anarcat@orangeseeds.org> » [ultime] # gpg: alias « Antoine Beaupré <anarcat@debian.org> » [ultime] # gpg: alias « Antoine Beaupré <anarcat@koumbit.org> » [ultime] # gpg: alias « Antoine Beaupré <anarcat@anarc.at> » [ultime]
Diffstat (limited to 'raphodo/cache.py')
-rw-r--r--raphodo/cache.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/raphodo/cache.py b/raphodo/cache.py
index 0801762..92e7464 100644
--- a/raphodo/cache.py
+++ b/raphodo/cache.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-# Copyright (C) 2015-2017 Damon Lynch <damonlynch@gmail.com>
+# Copyright (C) 2015-2018 Damon Lynch <damonlynch@gmail.com>
# This file is part of Rapid Photo Downloader.
#
@@ -47,7 +47,7 @@ http://specifications.freedesktop.org/thumbnail-spec/thumbnail-spec-latest.html
"""
__author__ = 'Damon Lynch'
-__copyright__ = "Copyright 2015-2017, Damon Lynch"
+__copyright__ = "Copyright 2015-2018, Damon Lynch"
import os
import sys
@@ -69,8 +69,7 @@ from raphodo.rpdsql import CacheSQL
GetThumbnail = namedtuple('GetThumbnail', 'disk_status, thumbnail, path')
-GetThumbnailPath = namedtuple('GetThumbnailPath', 'disk_status, path, mdatatime, '
- 'orientation_unknown')
+GetThumbnailPath = namedtuple('GetThumbnailPath', 'disk_status, path, mdatatime, orientation_unknown')
class MD5Name:
"""Generate MD5 hashes for file names."""
@@ -521,9 +520,13 @@ class ThumbnailCacheSql:
os.remove(thumbnail)
deleted_thumbnails.append(name)
if len(deleted_thumbnails):
- self.thumb_db.delete_thumbnails(deleted_thumbnails)
- logging.debug('Deleted {} thumbnail files that had not been '
- 'accessed for {} or more days'.format(len(deleted_thumbnails), days))
+ if self.thumb_db.cache_exists():
+ self.thumb_db.delete_thumbnails(deleted_thumbnails)
+ logging.debug(
+ 'Deleted {} thumbnail files that had not been accessed for {} or more days'.format(
+ len(deleted_thumbnails), days
+ )
+ )
def purge_cache(self) -> None:
"""