forked from 0x2620/pandora
poster
This commit is contained in:
parent
7efd182088
commit
43837ff529
2 changed files with 3 additions and 3 deletions
|
@ -887,7 +887,7 @@ class Stream(models.Model):
|
||||||
class PosterUrl(models.Model):
|
class PosterUrl(models.Model):
|
||||||
class Meta:
|
class Meta:
|
||||||
unique_together = ("movie", "service", "url")
|
unique_together = ("movie", "service", "url")
|
||||||
ordering = ('height', )
|
ordering = ('-height', )
|
||||||
|
|
||||||
movie = models.ForeignKey(Movie, related_name='poster_urls')
|
movie = models.ForeignKey(Movie, related_name='poster_urls')
|
||||||
url = models.CharField(max_length=1024)
|
url = models.CharField(max_length=1024)
|
||||||
|
|
|
@ -548,7 +548,7 @@ def frame(request, id, position, size):
|
||||||
raise Http404
|
raise Http404
|
||||||
return HttpFileResponse(frame, content_type='image/jpeg')
|
return HttpFileResponse(frame, content_type='image/jpeg')
|
||||||
|
|
||||||
def poster(request, id, size=128):
|
def poster(request, id, size=None):
|
||||||
movie = get_object_or_404(models.Movie, movieId=id)
|
movie = get_object_or_404(models.Movie, movieId=id)
|
||||||
if size == 'large':
|
if size == 'large':
|
||||||
size = None
|
size = None
|
||||||
|
@ -559,7 +559,7 @@ def poster(request, id, size=128):
|
||||||
if not os.path.exists(poster_path):
|
if not os.path.exists(poster_path):
|
||||||
poster_size = max(movie.poster.width, movie.poster.height)
|
poster_size = max(movie.poster.width, movie.poster.height)
|
||||||
if size > poster_size:
|
if size > poster_size:
|
||||||
return redirect('/%s/poster.large.jpg' % movie.movieId)
|
return redirect('/%s/poster.jpg' % movie.movieId)
|
||||||
extract.resize_image(movie.poster.path, poster_path, size=size)
|
extract.resize_image(movie.poster.path, poster_path, size=size)
|
||||||
else:
|
else:
|
||||||
poster_path = movie.poster.path
|
poster_path = movie.poster.path
|
||||||
|
|
Loading…
Reference in a new issue