cleanup meta parser

This commit is contained in:
j 2014-05-26 10:23:10 +02:00
commit 67d1814192
6 changed files with 49 additions and 6 deletions

View file

@ -75,9 +75,17 @@ def lookup(id):
del data['cover']
if 'author' in data:
data['author'] = [data['author']]
data['author'] = data['author'].split('; ')
if 'title' in data:
data['title'] = data['title'].replace(' : ', ': ')
if 'publisher' in data:
m = re.compile('(.+) : (.+), (\d{4})').findall(data['publisher'])
if m:
place, publisher, date = m[0]
data['publisher'] = publisher
data['date'] = date
data['places'] = [place]
logger.debug('lookup %s => %s', id, data.keys())
return data