Json & decode errors. fix #494

This commit is contained in:
Ruud
2012-07-01 13:48:38 +02:00
parent b7f1d28347
commit d562559562
3 changed files with 13 additions and 4 deletions
+4 -3
View File
@@ -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 + '>', '')
+2
View File
@@ -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()
+7 -1
View File
@@ -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 '{}')