Browse Source

Create binary files for images

pull/69/head
Ruud 14 years ago
parent
commit
6ec420db86
  1. 4
      couchpotato/core/plugins/base.py
  2. 2
      couchpotato/core/plugins/file/main.py

4
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:

2
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

Loading…
Cancel
Save