better unicode representation of imdb object

This commit is contained in:
j 2012-08-29 17:11:11 +02:00
parent 5482248fee
commit fc6b81383e

View file

@ -67,7 +67,7 @@ class Imdb(models.Model):
invalid = models.BooleanField(default=False)
def __unicode__(self):
return u"%s (%s)" % (self.title, self.imdb)
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')
@ -120,9 +120,9 @@ def get_new_ids(timeout=-1):
ids = re.compile('<loc>http://www.imdb.com/title/tt(\d{7})/combined</loc>').findall(s)
added = 0
for i in frozenset(ids) - known_ids:
m= Imdb(imdb=i)
print i
m = Imdb(imdb=i)
m.update()
print m
added += 1
if added:
print url, added