cache posters
This commit is contained in:
parent
e076b43904
commit
e745731da9
2 changed files with 12 additions and 1 deletions
|
@ -19,6 +19,7 @@ import ox.web.piratecinema
|
|||
|
||||
from lookup.models import MovieId
|
||||
|
||||
|
||||
def getPosters(movie_id, url_prefix='', limit=lambda x, y: 0.3 < x/y < 1):
|
||||
if not movie_id:
|
||||
return {}
|
||||
|
@ -174,3 +175,13 @@ def get_poster_urls(m):
|
|||
addPoster(data['poster'], 'apple.com', m.imdb_id)
|
||||
'''
|
||||
#fixme: get 0xdb still, possibly imdb still as fallback?
|
||||
|
||||
|
||||
def cache_all_posters():
|
||||
for p in PosterCache.objects.all().filter(failed=False, image='').order_by('-id'):
|
||||
poster = p.get()
|
||||
if poster and (not poster.width or not poster.height):
|
||||
p.failed = True
|
||||
p.status = "invalid image"
|
||||
p.image.delete()
|
||||
p.save()
|
||||
|
|
Loading…
Reference in a new issue