Browse Source

Json & decode errors. fix #494

pull/584/head
Ruud 13 years ago
parent
commit
d562559562
  1. 7
      couchpotato/core/plugins/renamer/main.py
  2. 2
      couchpotato/core/plugins/scanner/main.py
  3. 8
      couchpotato/core/settings/model.py

7
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 + '>', '')

2
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()

8
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 '{}')

Loading…
Cancel
Save