title should be full title, add seriesTitle, fixes #985

This commit is contained in:
j 2012-09-17 12:42:50 +02:00
parent 5399216083
commit 6bf5df57bb

View file

@ -10,7 +10,9 @@ import ox
def normalize_value(value):
if isinstance(value, str):
value = value.decode('utf-8')
return unicodedata.normalize('NFD', value)
if isinstance(value, unicode):
value = unicodedata.normalize('NFD', value)
return value
def find(info, guess=True):
q = Imdb.objects.all()
@ -21,8 +23,6 @@ def find(info, guess=True):
i.save()
q = Imdb.objects.filter(imdb=info['id'])
else:
if 'seriesTitle' in info:
info['title'] = info['seriesTitle']
for key in Imdb.keys:
if key in info and info[key]:
if isinstance(info[key], basestring):
@ -63,6 +63,7 @@ class Imdb(models.Model):
episodeTitle = models.CharField(max_length=1000, blank=True, default='')
episodeYear = models.CharField(max_length=4, blank=True, default='')
episodeDirector = models.CharField(max_length=1000, blank=True, default='')
seriesTitle = models.CharField(max_length=1000, blank=True, default='')
invalid = models.BooleanField(default=False)
@ -70,7 +71,7 @@ class Imdb(models.Model):
return u"[%s] %s%s" % (self.imdb, self.title, self.year and ' (%s)' % self.year or '')
keys = ('title', 'director', 'year', 'season', 'episode',
'episodeTitle', 'episodeYear', 'episodeDirector')
'seriesTitle', 'episodeTitle', 'episodeYear', 'episodeDirector')
def update(self):
info = ox.web.imdb.ImdbCombined(self.imdb)
@ -78,8 +79,6 @@ class Imdb(models.Model):
for key in self.keys:
if key in info:
value = info[key]
if key == 'title' and 'seriesTitle' in info:
value = info['seriesTitle']
if isinstance(value, list):
value = u'\n'.join(value) + '\n'
if isinstance(value, basestring):