better defaults, return broken frame instead of error, do not redirect to 0xdb.org poster

This commit is contained in:
j 2011-02-23 16:06:20 +01:00
commit 28bc942921
4 changed files with 5 additions and 2 deletions

View file

@ -330,6 +330,8 @@ class Item(models.Model):
stream['duration'] = s.info['duration']
if 'video' in s.info and s.info['video']:
stream['aspectRatio'] = s.info['video'][0]['width'] / s.info['video'][0]['height']
else:
stream['aspectRatio'] = 4/3
if settings.XSENDFILE or settings.XACCELREDIRECT:
stream['baseUrl'] = '/%s' % self.itemId
else:
@ -607,6 +609,8 @@ class Item(models.Model):
'frames', "%d"%width, "%s.jpg"%position)
if not os.path.exists(path):
extract.frame(stream.video.path, path, position, width)
if not os.path.exists(path):
path = os.path.join(settings.STATIC_ROOT, 'png/frame.broken.png')
return path
@property

View file

@ -497,7 +497,6 @@ def poster(request, id, size=None):
else:
if not size:
size='large'
return redirect('http://0xdb.org/%s/poster.%s.jpg' % (item.itemId, size))
poster_path = os.path.join(settings.STATIC_ROOT, 'png/posterDark.48.png')
return HttpFileResponse(poster_path, content_type='image/jpeg')