From f9f39dff4a74dce0a22a15af5e285fe28d15fb43 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Fri, 13 Jan 2012 19:22:33 +0530 Subject: [PATCH] add archive.org link --- oxdata/lookup/models.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/oxdata/lookup/models.py b/oxdata/lookup/models.py index 05aeccd..22885ec 100644 --- a/oxdata/lookup/models.py +++ b/oxdata/lookup/models.py @@ -43,6 +43,7 @@ class MovieId(models.Model): imdb_id = models.CharField(max_length=7, unique=True, blank=True, null=True, default=None) amg_id = models.IntegerField(unique=True, blank=True, null=True, default=None) + archiveorg_id = models.IntegerField(unique=True, blank=True, null=True, default=None) wikipedia_id = models.CharField(unique=True, max_length=255, blank=True, null=True, default=None) criterion_id = models.IntegerField(unique=True, blank=True, null=True, default=None) impawards_id = models.CharField(max_length=255, unique=True, blank=True, null=True, default=None) @@ -63,7 +64,7 @@ class MovieId(models.Model): wikipedia_url = ox.web.wikipedia.getUrl(self.wikipedia_id) data = ox.web.wikipedia.getMovieData(wikipedia_url) _key = {} - for key in ('imdb_id', 'amg_id'): + for key in ('imdb_id', 'amg_id', 'archiveorg_id'): if key in data: if data[key] and not getattr(self, _key.get(key, key)): setattr(self, _key.get(key, key), data[key]) @@ -131,6 +132,9 @@ class MovieId(models.Model): if self.criterion_id: links.append({'source': 'Criterion', 'url': ox.web.criterion.getUrl(self.criterion_id)}) + if self.archiveorg_id: + links.append({'source': 'Wikipedia', + 'url': ox.web.archive.getUrl(self.archiveorg_id)}) links.append({'source': 'Google', 'url': 'http://google.com/search?q=%s' % quote('"%s (%s)"'%(self.title, self.year))}) return links