normalize values

This commit is contained in:
j 2014-11-11 11:50:09 +01:00
parent 970d5c5d84
commit 01ace414cb

View file

@ -50,7 +50,7 @@ def find(info, guess=True):
return m return m
#For now fallback to ox.web.imdb.guess and try again #For now fallback to ox.web.imdb.guess and try again
if guess and 'title' in info: if guess and 'title' in info:
id = ox.web.imdb.get_movie_id(info['title']) id = ox.web.imdb.get_movie_id(normalize_value(info['title']))
if id: if id:
i, created = Imdb.objects.get_or_create(imdb=id) i, created = Imdb.objects.get_or_create(imdb=id)
if created: if created:
@ -270,9 +270,9 @@ class Match(models.Model):
@classmethod @classmethod
def get_keys(cls, data): def get_keys(cls, data):
data = { data = {
'title': data['title'].lower(), 'title': normalize_value(data['title'].lower()),
'year': str(data.get('year', '')), 'year': str(data.get('year', '')),
'director': ';'.join(sorted(data.get('director', []))) 'director': normalize_value(';'.join(sorted(data.get('director', []))))
} }
keys = [] keys = []
if not data['director']: if not data['director']: