use ox.web.imdb.getMovieId but check result
This commit is contained in:
parent
1d38283276
commit
b826a13125
2 changed files with 10 additions and 1 deletions
|
@ -7,7 +7,7 @@ from django.db import models
|
|||
import ox
|
||||
|
||||
|
||||
def find(info):
|
||||
def find(info, guess=True):
|
||||
q = Imdb.objects.all()
|
||||
for key in Imdb.keys:
|
||||
if key in info and info[key]:
|
||||
|
@ -21,6 +21,14 @@ def find(info):
|
|||
q = q.filter(**{fkey:info[key]})
|
||||
if q.count() == 1:
|
||||
return q[0]
|
||||
#For now fallback to ox.web.imdb.guess and try again
|
||||
if guess:
|
||||
id = ox.web.imdb.getMovieId(info['title'])
|
||||
if id:
|
||||
i, created = Imdb.objects.get_or_create(imdb=id)
|
||||
if created:
|
||||
i.update()
|
||||
return find(info, False)
|
||||
return None
|
||||
|
||||
class Imdb(models.Model):
|
||||
|
|
1
oxdata/templates/500.html
Normal file
1
oxdata/templates/500.html
Normal file
|
@ -0,0 +1 @@
|
|||
500 error
|
Loading…
Reference in a new issue