use https if available: google.com, archive.org, wikipedia.org

This commit is contained in:
j 2014-08-12 10:56:20 +02:00
parent 336d646c9c
commit fbb702e349

View file

@ -151,20 +151,30 @@ class MovieId(models.Model):
def links(self):
links = []
if self.imdb_id:
links.append({'source': 'IMDb',
'url': ox.web.imdb.get_url(self.imdb_id)})
links.append({
'source': 'IMDb',
'url': ox.web.imdb.get_url(self.imdb_id)
})
if self.wikipedia_id:
links.append({'source': 'Wikipedia',
'url': ox.web.wikipedia.get_url(self.wikipedia_id)})
links.append({
'source': 'Wikipedia',
'url': ox.web.wikipedia.get_url(self.wikipedia_id).replace('http://', 'https://')
})
if self.criterion_id:
links.append({'source': 'Criterion',
'url': ox.web.criterion.get_url(self.criterion_id)})
links.append({
'source': 'Criterion',
'url': ox.web.criterion.get_url(self.criterion_id)
})
if self.archiveorg_id:
links.append({'source': 'Internet Archive',
'url': ox.web.archive.get_url(self.archiveorg_id)})
links.append({
'source': 'Internet Archive',
'url': ox.web.archive.get_url(self.archiveorg_id).replace('http://', 'https://')
})
qs = u'"%s (%s)"'%(self.title, self.year)
links.append({'source': 'Google',
'url': 'http://google.com/search?q=%s' % quote(qs.encode('utf-8'))})
links.append({
'source': 'Google',
'url': 'https://google.com/search?q=%s' % quote(qs.encode('utf-8'))
})
return links
def info(self, key):