[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Maposmatic-dev] [PATCH maposmatic] Exclude thumbnails from the list of
From: |
Maxime Petazzoni |
Subject: |
[Maposmatic-dev] [PATCH maposmatic] Exclude thumbnails from the list of considered files for cleanup |
Date: |
Wed, 3 Feb 2010 09:59:28 +0100 |
Signed-off-by: Maxime Petazzoni <address@hidden>
---
scripts/daemon.py | 3 ++-
scripts/render.py | 4 +++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/scripts/daemon.py b/scripts/daemon.py
index 9ff44b7..3122868 100755
--- a/scripts/daemon.py
+++ b/scripts/daemon.py
@@ -207,7 +207,8 @@ class RenderingsGarbageCollector(threading.Thread):
files = map(lambda f: self.get_file_info(f),
[os.path.join(RENDERING_RESULT_PATH, f)
for f in os.listdir(RENDERING_RESULT_PATH)
- if not f.startswith('.')])
+ if not (f.startswith('.') or
+ f.endswith(render.THUMBNAIL_SUFFIX))])
# Compute the total size occupied by the renderings, and the actual 80%
# threshold, in bytes.
diff --git a/scripts/render.py b/scripts/render.py
index ea370f6..97bc065 100755
--- a/scripts/render.py
+++ b/scripts/render.py
@@ -39,6 +39,8 @@ RESULT_KEYBOARD_INTERRUPT = 1
RESULT_RENDERING_EXCEPTION = 2
RESULT_TIMEOUT_REACHED = 3
+THUMBNAIL_SUFFIX = '_small.png'
+
class TimingOutJobRenderer:
"""
The TimingOutJobRenderer is a wrapper around JobRenderer implementing
@@ -146,7 +148,7 @@ class JobRenderer(threading.Thread):
if 'png' in RENDERING_RESULT_FORMATS:
img = Image.open(prefix + '.png')
img.thumbnail((200, 200), Image.ANTIALIAS)
- img.save(prefix + '_small.png')
+ img.save(prefix + THUMBNAIL_SUFFIX)
self.result = RESULT_SUCCESS
LOG.info("Finished rendering of job #%d." % self.job.id)
--
1.6.3.3.277.g88938c