diff --git a/couchpotato/core/plugins/base.py b/couchpotato/core/plugins/base.py index 7a51b316..bf4a5f1a 100644 --- a/couchpotato/core/plugins/base.py +++ b/couchpotato/core/plugins/base.py @@ -78,6 +78,7 @@ class Plugin(object): f = open(path, 'w' if not binary else 'wb') f.write(content) f.close() + os.chmod(path, Env.getPermission('file')) except Exception, e: log.error('Unable writing to file "%s": %s' % (path, e)) diff --git a/couchpotato/core/plugins/renamer/main.py b/couchpotato/core/plugins/renamer/main.py index 51ea75d1..92b856b5 100644 --- a/couchpotato/core/plugins/renamer/main.py +++ b/couchpotato/core/plugins/renamer/main.py @@ -7,6 +7,7 @@ from couchpotato.core.helpers.variable import getExt from couchpotato.core.logger import CPLog from couchpotato.core.plugins.base import Plugin from couchpotato.core.settings.model import Library +from couchpotato.environment import Env import os.path import re import shutil @@ -311,6 +312,12 @@ class Renamer(Plugin): def moveFile(self, old, dest): try: shutil.move(old, dest) + + try: + os.chmod(dest, Env.getPermission('folder')) + except: + log.error('Failed setting permissions for file: %s' % dest) + except: log.error("Couldn't move file '%s' to '%s': %s" % (old, dest, traceback.format_exc())) raise Exception