From 7df2dd95c8151f58af5597dc0b4aa6666560b61b Mon Sep 17 00:00:00 2001
From: j <0x006A@0x2620.org>
Date: Thu, 7 Nov 2013 12:01:38 +0000
Subject: [PATCH] embed requested url not just time via oembed
---
pandora/item/views.py | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/pandora/item/views.py b/pandora/item/views.py
index a92b1e78..1b658a0c 100644
--- a/pandora/item/views.py
+++ b/pandora/item/views.py
@@ -1102,9 +1102,13 @@ def oembed(request):
url = request.GET['url']
parts = urlparse(url).path.split('/')
itemId = parts[1]
- #fixme: embed should reflect actuall url
item = get_object_or_404_json(models.Item, itemId=itemId)
- embed_url = request.build_absolute_uri('/%s#embed' % item.itemId)
+ embed_url = request.build_absolute_uri('/%s' % itemId)
+ if url.startswith(embed_url):
+ embed_url = '%s#embed' % url
+ else:
+ embed_url = '%s#embed' % embed_url
+
oembed = {}
oembed['version'] = '1.0'
oembed['type'] = 'video'
@@ -1119,7 +1123,7 @@ def oembed(request):
if width > maxwidth:
width = maxwidth
height = min(maxheight, int(width / item.stream_aspect))
- oembed['html'] = '' % (width, height, embed_url)
+ oembed['html'] = '' % (width, height, embed_url)
oembed['width'] = width
oembed['height'] = height
thumbheight = 96