This commit is contained in:
j 2011-11-03 11:23:00 +01:00
commit 5151f8195b
3 changed files with 10 additions and 14 deletions

View file

@ -20,6 +20,16 @@ def addPoster(m, url, site, site_id):
def getIds(): def getIds():
for id in ox.web.impawards.getIds(): for id in ox.web.impawards.getIds():
if id in (
'2005/night',
'2007/hands_of_the_dragon',
'2008/nosferatu_project',
'2009/murph',
'1962/well_bury_you',
'1974/matter_of_winning',
'2006/last_time_i_trust_you_with_anything',
):
continue
if models.MovieId.objects.all().filter(impawards_id=id).count() == 0: if models.MovieId.objects.all().filter(impawards_id=id).count() == 0:
print 'impawards', ox.web.impawards.getUrl(id) print 'impawards', ox.web.impawards.getUrl(id)
data = ox.web.impawards.getData(id) data = ox.web.impawards.getData(id)

View file

@ -4,7 +4,3 @@
import models import models
from django.contrib import admin from django.contrib import admin
class PosterAdmin(admin.ModelAdmin):
search_fields = ['url', 'movie_id__title', 'movie_id__imdb_id']
admin.site.register(models.Poster, PosterAdmin)

View file

@ -40,9 +40,6 @@ def getPosters(movie_id, url_prefix='', limit=lambda x, y: 0.3 < x/y < 1):
for p in posters.keys(): for p in posters.keys():
if not posters[p]: if not posters[p]:
del posters[p] del posters[p]
poster = Poster.objects.filter(movie_id=movie_id).exclude(poster='')
if poster.count() > 0:
posters['local'] = [p.poster.url]
return posters return posters
def poster_path(url, filename): def poster_path(url, filename):
@ -101,13 +98,6 @@ class PosterCache(models.Model):
self.save() self.save()
return self.image return self.image
class Poster(models.Model):
created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True)
movie_id = models.ForeignKey(MovieId, related_name='poster')
poster = models.ImageField(max_length=255, upload_to=lambda i, f: poster_path('upload/%s' % i.id, f))
def getPosterUrls(m): def getPosterUrls(m):
def addPoster(url, site, site_id): def addPoster(url, site, site_id):
if PosterCache.objects.all().filter(url=url, movie_id=m).count() == 0: if PosterCache.objects.all().filter(url=url, movie_id=m).count() == 0: