From 82d11e412f39e0242c05ef958c9fed01f45df8ae Mon Sep 17 00:00:00 2001 From: j Date: Thu, 14 Jan 2016 13:24:34 +0530 Subject: [PATCH] better filenames --- oml/item/models.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/oml/item/models.py b/oml/item/models.py index 268b354..3541764 100644 --- a/oml/item/models.py +++ b/oml/item/models.py @@ -576,6 +576,8 @@ class File(db.Model): author = '; '.join([get_sort_name(a) for a in j.get('author', [])]) if not author: author = 'Unknown Author' + if ' (Ed.)' in author: + author = author.replace(' (Ed.)', '') + ' (Ed.)' title = j.get('title', 'Untitled') extension = j['extension'] @@ -593,6 +595,7 @@ class File(db.Model): if date and len(date) >= 4: extra += ' ' + date[:4] if extra: + extra = format_underscores(extra) title = '%s (%s)' % (title, extra.strip()) filename = '%s.%s' % (title, extension) first = unicodedata.normalize('NFD', author[0].upper())[0].upper()