From baec34cc51c5822c002b22072a9e99d662dce465 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= Date: Mon, 30 Jul 2018 10:50:17 -0400 Subject: New upstream version 0.9.10 --- raphodo/cache.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'raphodo/cache.py') 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 +# Copyright (C) 2015-2018 Damon Lynch # 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: """ -- cgit v1.2.3