fix posters
This commit is contained in:
parent
7991849d44
commit
b5a88e0a7e
1 changed files with 2 additions and 4 deletions
|
@ -86,9 +86,9 @@ class PosterCache(models.Model):
|
||||||
name = hashlib.sha1(url).hexdigest()
|
name = hashlib.sha1(url).hexdigest()
|
||||||
try:
|
try:
|
||||||
data = ox.net.read_url(url)
|
data = ox.net.read_url(url)
|
||||||
self.image.name = poster_path(self.url, os.path.basename(url))
|
self.image.name = poster_path(self.url, os.path.basename(self.url))
|
||||||
ox.makedirs(os.path.dirname(self.image.path))
|
ox.makedirs(os.path.dirname(self.image.path))
|
||||||
with open(self.image.path, 'w') as f:
|
with open(self.image.path, 'wb') as f:
|
||||||
f.write(data)
|
f.write(data)
|
||||||
self.save()
|
self.save()
|
||||||
except urllib.error.HTTPError as e:
|
except urllib.error.HTTPError as e:
|
||||||
|
@ -135,7 +135,6 @@ def get_poster_urls(m):
|
||||||
poster = ox.web.imdb.get_movie_poster(m.imdb_id)
|
poster = ox.web.imdb.get_movie_poster(m.imdb_id)
|
||||||
if poster:
|
if poster:
|
||||||
addPoster(poster, 'imdb.com', m.imdb_id)
|
addPoster(poster, 'imdb.com', m.imdb_id)
|
||||||
|
|
||||||
#site is sometimes down
|
#site is sometimes down
|
||||||
#for poster in ox.web.movieposterdb.get_data(m.imdb_id)['posters']:
|
#for poster in ox.web.movieposterdb.get_data(m.imdb_id)['posters']:
|
||||||
# addPoster(poster, 'movieposterdb.com', m.imdb_id)
|
# addPoster(poster, 'movieposterdb.com', m.imdb_id)
|
||||||
|
@ -171,4 +170,3 @@ def get_poster_urls(m):
|
||||||
addPoster(data['poster'], 'apple.com', m.imdb_id)
|
addPoster(data['poster'], 'apple.com', m.imdb_id)
|
||||||
'''
|
'''
|
||||||
#fixme: get 0xdb still, possibly imdb still as fallback?
|
#fixme: get 0xdb still, possibly imdb still as fallback?
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue