From f50c8504cf9bf47462d127574d30ac3f674a1820 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sun, 16 Feb 2014 14:19:15 +0100 Subject: [PATCH] Encode before copy metadata. fix #2832 --- couchpotato/core/plugins/base.py | 2 +- couchpotato/core/providers/metadata/base.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/couchpotato/core/plugins/base.py b/couchpotato/core/plugins/base.py index e70c3bc6..378ed50c 100644 --- a/couchpotato/core/plugins/base.py +++ b/couchpotato/core/plugins/base.py @@ -110,7 +110,7 @@ class Plugin(object): f.write(content) f.close() os.chmod(path, Env.getPermission('file')) - except Exception as e: + except: log.error('Unable writing to file "%s": %s', (path, traceback.format_exc())) if os.path.isfile(path): os.remove(path) diff --git a/couchpotato/core/providers/metadata/base.py b/couchpotato/core/providers/metadata/base.py index 72d07609..d1274adf 100644 --- a/couchpotato/core/providers/metadata/base.py +++ b/couchpotato/core/providers/metadata/base.py @@ -1,4 +1,5 @@ from couchpotato.core.event import addEvent, fireEvent +from couchpotato.core.helpers.encoding import sp from couchpotato.core.helpers.variable import mergeDicts from couchpotato.core.logger import CPLog from couchpotato.core.plugins.base import Plugin @@ -48,6 +49,9 @@ class MetaDataBase(Plugin): if content: log.debug('Creating %s file: %s', (file_type, name)) if os.path.isfile(content): + content = sp(content) + name = sp(name) + shutil.copy2(content, name) shutil.copyfile(content, name) @@ -59,7 +63,7 @@ class MetaDataBase(Plugin): group['renamed_files'].append(name) try: - os.chmod(name, Env.getPermission('file')) + os.chmod(sp(name), Env.getPermission('file')) except: log.debug('Failed setting permissions for %s: %s', (name, traceback.format_exc()))