From 6ec420db86218acc7d1db9f190e35c665c69a9be Mon Sep 17 00:00:00 2001 From: Ruud Date: Sat, 14 Jan 2012 22:05:34 +0100 Subject: [PATCH] Create binary files for images --- couchpotato/core/plugins/base.py | 4 ++-- couchpotato/core/plugins/file/main.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/couchpotato/core/plugins/base.py b/couchpotato/core/plugins/base.py index 2653341b..87d6f75c 100644 --- a/couchpotato/core/plugins/base.py +++ b/couchpotato/core/plugins/base.py @@ -69,12 +69,12 @@ class Plugin(object): d = os.path.join(self.plugin_path, 'static') return send_from_directory(d, filename) - def createFile(self, path, content): + def createFile(self, path, content, binary = False): self.makeDir(os.path.dirname(path)) try: - f = open(path, 'w') + f = open(path, 'w' if not binary else 'wb') f.write(content) f.close() except Exception, e: diff --git a/couchpotato/core/plugins/file/main.py b/couchpotato/core/plugins/file/main.py index 18a41b71..5fed471b 100644 --- a/couchpotato/core/plugins/file/main.py +++ b/couchpotato/core/plugins/file/main.py @@ -41,7 +41,7 @@ class FileManager(Plugin): dest = os.path.join(Env.get('cache_dir'), '%s.%s' % (md5(url), getExt(url))) if overwrite or not os.path.isfile(dest): - self.createFile(dest, filedata) + self.createFile(dest, filedata, binary = True) return dest