diff --git a/couchpotato/core/plugins/renamer/main.py b/couchpotato/core/plugins/renamer/main.py index fb2a768..50f7e13 100644 --- a/couchpotato/core/plugins/renamer/main.py +++ b/couchpotato/core/plugins/renamer/main.py @@ -258,7 +258,7 @@ class Renamer(Plugin): # Mark movie "done" onces it found the quality with the finish check try: - if movie.status_id == active_status.get('id'): + if movie.status_id == active_status.get('id') and movie.profile: for profile_type in movie.profile.types: if profile_type.quality_id == group['meta_data']['quality']['id'] and profile_type.finish: movie.status_id = done_status.get('id') @@ -324,7 +324,8 @@ class Renamer(Plugin): log.info('Removing "%s"', src) try: - os.remove(src) + if os.path.isfile(src): + os.remove(src) except: log.error('Failed removing %s: %s', (src, traceback.format_exc())) self.tagDir(group, 'failed_remove') @@ -440,7 +441,7 @@ class Renamer(Plugin): replaced = toUnicode(string) for x, r in replacements.iteritems(): if r is not None: - replaced = replaced.replace('<%s>' % toUnicode(x), toUnicode(r)) + replaced = replaced.replace(u'<%s>' % toUnicode(x), toUnicode(r)) else: #If information is not available, we don't want the tag in the filename replaced = replaced.replace('<' + x + '>', '') diff --git a/couchpotato/core/plugins/scanner/main.py b/couchpotato/core/plugins/scanner/main.py index f6c7c05..d31726f 100644 --- a/couchpotato/core/plugins/scanner/main.py +++ b/couchpotato/core/plugins/scanner/main.py @@ -151,6 +151,8 @@ class Scanner(Plugin): files.append(os.path.join(root, filename)) except: log.error('Failed getting files from %s: %s', (folder, traceback.format_exc())) + else: + files = [ss(x) for x in files] db = get_session() diff --git a/couchpotato/core/settings/model.py b/couchpotato/core/settings/model.py index c1251df..553c035 100644 --- a/couchpotato/core/settings/model.py +++ b/couchpotato/core/settings/model.py @@ -28,7 +28,13 @@ class JsonType(TypeDecorator): impl = UnicodeText def process_bind_param(self, value, dialect): - return toUnicode(json.dumps(value, cls = SetEncoder)) + try: + return toUnicode(json.dumps(value, cls = SetEncoder)) + except: + try: + return toUnicode(json.dumps(value, cls = SetEncoder, encoding = 'latin-1')) + except: + raise def process_result_value(self, value, dialect): return json.loads(value if value else '{}')