add google link

This commit is contained in:
j 2011-12-20 19:55:07 +05:30
parent c8b1b3072d
commit 896a5f3441
2 changed files with 7 additions and 0 deletions

View file

@ -2,6 +2,7 @@
# vi:si:et:sw=4:sts=4:ts=4 # vi:si:et:sw=4:sts=4:ts=4
import os import os
import hashlib import hashlib
from urllib import quote
from django.db import models from django.db import models
from django.db.models import Q, Max from django.db.models import Q, Max
@ -130,6 +131,8 @@ class MovieId(models.Model):
if self.criterion_id: if self.criterion_id:
links.append({'source': 'Criterion', links.append({'source': 'Criterion',
'url': ox.web.criterion.getUrl(self.criterion_id)}) 'url': ox.web.criterion.getUrl(self.criterion_id)})
links.append({'source': 'Google',
'url': 'http://google.com/search?q=%s' % quote('"%s (%s)"'%(self.title, self.year))})
return links return links
def json(self): def json(self):

View file

@ -11,6 +11,10 @@ def find(info, guess=True):
q = Imdb.objects.all() q = Imdb.objects.all()
if 'id' in info: if 'id' in info:
q = q.filter(imdb=info['id']) q = q.filter(imdb=info['id'])
if q.count() == 0 and len(info['id']) == 7:
i = Imdb(imdb=info['id'])
i.save()
q = Imdb.objects.filter(imdb=info['id'])
else: else:
if 'seriesTitle' in info: if 'seriesTitle' in info:
info['title'] = info['seriesTitle'] info['title'] = info['seriesTitle']