diff options
author | Antoine Beaupré <anarcat@debian.org> | 2018-07-30 10:50:18 -0400 |
---|---|---|
committer | Antoine Beaupré <anarcat@debian.org> | 2018-07-30 10:50:18 -0400 |
commit | 8b136df8c340d1e1ee1874ef60850aa9bd153d49 (patch) | |
tree | 79224158005471028278eb4ddd66a73a2e43294c /raphodo/cache.py | |
parent | e93ead0a34c25ef37904e0dc9634cdd045f05e64 (diff) | |
parent | baec34cc51c5822c002b22072a9e99d662dce465 (diff) |
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.py | 17 |
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: """ |