better defaults, return broken frame instead of error, do not redirect to 0xdb.org poster
This commit is contained in:
parent
7a811c53d6
commit
88df4a3ee6
4 changed files with 5 additions and 2 deletions
|
@ -330,6 +330,8 @@ class Item(models.Model):
|
||||||
stream['duration'] = s.info['duration']
|
stream['duration'] = s.info['duration']
|
||||||
if 'video' in s.info and s.info['video']:
|
if 'video' in s.info and s.info['video']:
|
||||||
stream['aspectRatio'] = s.info['video'][0]['width'] / s.info['video'][0]['height']
|
stream['aspectRatio'] = s.info['video'][0]['width'] / s.info['video'][0]['height']
|
||||||
|
else:
|
||||||
|
stream['aspectRatio'] = 4/3
|
||||||
if settings.XSENDFILE or settings.XACCELREDIRECT:
|
if settings.XSENDFILE or settings.XACCELREDIRECT:
|
||||||
stream['baseUrl'] = '/%s' % self.itemId
|
stream['baseUrl'] = '/%s' % self.itemId
|
||||||
else:
|
else:
|
||||||
|
@ -607,6 +609,8 @@ class Item(models.Model):
|
||||||
'frames', "%d"%width, "%s.jpg"%position)
|
'frames', "%d"%width, "%s.jpg"%position)
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
extract.frame(stream.video.path, path, position, width)
|
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
|
return path
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -497,7 +497,6 @@ def poster(request, id, size=None):
|
||||||
else:
|
else:
|
||||||
if not size:
|
if not size:
|
||||||
size='large'
|
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')
|
poster_path = os.path.join(settings.STATIC_ROOT, 'png/posterDark.48.png')
|
||||||
return HttpFileResponse(poster_path, content_type='image/jpeg')
|
return HttpFileResponse(poster_path, content_type='image/jpeg')
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
<!--
|
<!--
|
||||||
<div id="static_apidocs">
|
<div id="static_apidocs">
|
||||||
<h1>{{sitename}} Public API</h1>
|
<h1>{{sitename}} Public API</h1>
|
||||||
<a href="http://code.0xdb.org/pandora/annotate/head%3A/pandora/backend/views.py">look inside</a>
|
<a href="http://code.0x2620.org/pandora/annotate/head%3A/pandora/backend/views.py">look inside</a>
|
||||||
<div>
|
<div>
|
||||||
{% for f in api %}
|
{% for f in api %}
|
||||||
<div>
|
<div>
|
||||||
|
|
BIN
static/png/frame.broken.png
Normal file
BIN
static/png/frame.broken.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Loading…
Reference in a new issue