From 3818012f91564e1099f4f0efbae9beaa2bcf07ef Mon Sep 17 00:00:00 2001 From: Julien Malik Date: Mon, 15 Feb 2016 18:06:00 +0100 Subject: [PATCH] [fix] quality and autoorient need to be in the cache --- prosopopee/prosopopee.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/prosopopee/prosopopee.py b/prosopopee/prosopopee.py index 43777c6..81321ce 100644 --- a/prosopopee/prosopopee.py +++ b/prosopopee/prosopopee.py @@ -68,14 +68,26 @@ class Image(object): def __init__(self, options): # assuming string if not isinstance(options, dict): - name = options options = {"name": options} - self.name = name - self.quality = options.get("quality", DEFAULT_GM_QUALITY) - self.autoorient = options.get("auto-orient", DEFAULT_GM_AUTOORIENT) + if not options.has_key("quality"): + options["quality"] = DEFAULT_GM_QUALITY + if not options.has_key("autoorient"): + options["autoorient"] = DEFAULT_GM_AUTOORIENT + self.options = options.copy() # used for caching, if it's modified -> regenerate - del self.options["name"] + + @property + def name(self): + return self.options["name"] + + @property + def quality(self): + return self.options["quality"] + + @property + def autoorient(self): + return self.options["autoorient"] def copy(self): source, target = os.path.join(self.base_dir, self.name), os.path.join(self.target_dir, self.name)