From 28bc942921d6517d1aa62cfb0db08033e1b73044 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Wed, 23 Feb 2011 16:06:20 +0100 Subject: [PATCH] better defaults, return broken frame instead of error, do not redirect to 0xdb.org poster --- pandora/item/models.py | 4 ++++ pandora/item/views.py | 1 - pandora/templates/api.html | 2 +- static/png/frame.broken.png | Bin 0 -> 1128 bytes 4 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 static/png/frame.broken.png diff --git a/pandora/item/models.py b/pandora/item/models.py index e243945..03a1d77 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -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 diff --git a/pandora/item/views.py b/pandora/item/views.py index 6a48b40..0c4fc7a 100644 --- a/pandora/item/views.py +++ b/pandora/item/views.py @@ -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') diff --git a/pandora/templates/api.html b/pandora/templates/api.html index c0022bf..a4247a8 100644 --- a/pandora/templates/api.html +++ b/pandora/templates/api.html @@ -22,7 +22,7 @@ ~rMuSBS$oH`p6 zpCfoK2Lej|8W_mK-CtmkWv2&m1IRl9K&~8=D|Km|Jliv7uu`R5yMzrp>m+9IL%74t zt12fmf_&2@9xZfc{|t)U|No`#${QSjdVZ7*Nd%+efIl3V8Txy6yuQlq=LgC`p00i_ I>zopr02;8%a{vGU literal 0 HcmV?d00001