[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[linterna-magica-commit] [92] Merging Blip.tv support from trunk r90.
From: |
Ivaylo Valkov |
Subject: |
[linterna-magica-commit] [92] Merging Blip.tv support from trunk r90. |
Date: |
Tue, 14 Jun 2011 16:20:27 +0000 |
Revision: 92
http://svn.sv.gnu.org/viewvc/?view=rev&root=linterna-magica&revision=92
Author: valkov
Date: 2011-06-14 16:20:26 +0000 (Tue, 14 Jun 2011)
Log Message:
-----------
Merging Blip.tv support from trunk r90. Fixes bugs #33556. Closes tasks #11062.
Revision Links:
--------------
http://svn.sv.gnu.org/viewvc/?view=rev&root=linterna-magica&revision=90
Ticket Links:
------------
http://savannah.gnu.org/task/?11062
http://savannah.gnu.org/bugs/?33556
Modified Paths:
--------------
branches/0.0.9/src/lm_constructors.js
branches/0.0.9/src/lm_extract_dom_objects.js
branches/0.0.9/src/lm_extract_js_pokkariplayer.js
branches/0.0.9/src/lm_extract_video_link.js
branches/0.0.9/src/lm_remove_plugin_install_warning.js
branches/0.0.9/src/lm_site_bliptv.js
Property Changed:
----------------
branches/0.0.9/
Property changes on: branches/0.0.9
___________________________________________________________________
Modified: svn:mergeinfo
- /trunk:6,9,11,13,19,21,52,55,57,67,73,81,84-85
+ /trunk:6,9,11,13,19,21,52,55,57,67,73,81,84-85,90
Modified: branches/0.0.9/src/lm_constructors.js
===================================================================
--- branches/0.0.9/src/lm_constructors.js 2011-06-14 16:14:24 UTC (rev 91)
+++ branches/0.0.9/src/lm_constructors.js 2011-06-14 16:20:26 UTC (rev 92)
@@ -127,10 +127,7 @@
this.request_video_link({video_id: window.location.pathname});
}
// If there is a plugin installed do not search in scripts.
- // Exception for blip.tv. This is the easiesy way to
- // support it with installed plugin.
else if (!this.plugin_is_installed ||
- /blip\.tv/i.test(window.location.hostname) ||
/myvideo\.de/i.test(window.location.hostname) ||
/theonion\.com/i.test(window.location.hostname))
{
Modified: branches/0.0.9/src/lm_extract_dom_objects.js
===================================================================
--- branches/0.0.9/src/lm_extract_dom_objects.js 2011-06-14 16:14:24 UTC
(rev 91)
+++ branches/0.0.9/src/lm_extract_dom_objects.js 2011-06-14 16:20:26 UTC
(rev 92)
@@ -251,6 +251,14 @@
self.request_video_link.apply(self,[data]);
}, this.wait_dailymotion);
}
+ else if (/blip\.tv/i.test(window.location.hostname) ||
+ (object.hasAttribute('src') &&
+ /blip\.tv/i.test(object.getAttribute('src'))) ||
+ (object.hasAttribute('data') &&
+ /blip\.tv/i.test(object.getAttribute('data'))))
+ {
+ this.request_bliptv_jsonp_data(object_data);
+ }
else
{
this.request_video_link(object_data);
Modified: branches/0.0.9/src/lm_extract_js_pokkariplayer.js
===================================================================
--- branches/0.0.9/src/lm_extract_js_pokkariplayer.js 2011-06-14 16:14:24 UTC
(rev 91)
+++ branches/0.0.9/src/lm_extract_js_pokkariplayer.js 2011-06-14 16:20:26 UTC
(rev 92)
@@ -27,8 +27,9 @@
// END OF LICENSE HEADER
-// Extracts object data for flash objects created with PokkariPlayer (blip.tv)
-// flash library
+// Extracts object data for flash objects created with PokkariPlayer
+// flash library. Used to be for Blip.tv, but the site changed. Some
+// other sites might use this code.
LinternaMagica.prototype.
extract_object_from_script_pokkariplayer = function ()
{
@@ -95,10 +96,6 @@
object_data.link = url;
object_data.mime = mime;
object_data.parent = element;
- if (/blip\.tv/i.test(window.location.hostname))
- {
- object_data.hd_links = this.extract_bliptv_hd_links();
- }
return object_data;
}
Modified: branches/0.0.9/src/lm_extract_video_link.js
===================================================================
--- branches/0.0.9/src/lm_extract_video_link.js 2011-06-14 16:14:24 UTC (rev 91)
+++ branches/0.0.9/src/lm_extract_video_link.js 2011-06-14 16:20:26 UTC (rev 92)
@@ -234,21 +234,39 @@
// Fix vbox7.com (flashvars="id=...")
data = "&"+data;
- // 06.07.2010 Update for vidoemo.com video3 and \\\/
- // slashes before and after might create bugs
- // 18.12.2010 Update is for vimeo.com : vimeo_clip_
- // 12.02.2011 Update for myvideo.de. php&ID and \\\. This migth break
- // 25.02.2011 Update for videoclipsdump.com
- // player_config\\\.php\\\ must be after vid|
- // 11.06.2011 Update for theonion.com
- // \\\/video_embed\\\/...
- var video_id_re = new RegExp (
- "(\\\"|\\\'|\\\&|\\\?|\\\;|\\\/|\\\.|\\\=)(itemid|clip_id|video_id|"+
- "vid|player_config\\\.php\\\?v|"+
-
"videoid|media_id|vkey|video3|_videoid|vimeo_clip_|php&ID|\\\/video_embed\\\/\\\?id)"+
- "(\\\"|\\\')*(\\\=|\\\:|,|\\\/)\\\s*(\\\"|\\\')*"+
- "([a-zA-Z0-9\\\-\\\_]+)",
+
+ var video_id_re = null;
+
+ if (/blip\.tv/i.test(window.location.hostname) ||
+ /blip\.tv/i.test(data))
+ {
+ // Blip.tv has a JSONP API that could be used in remote
+ // sites. That is why we cant search for blip.tv directly in
+ // the data.
+ // http://wiki.blip.tv/index.php/Extract_metadata_from_our_embed_code
+ video_id_re = new RegExp(
+ "blip\\\.tv\\\/play\\\/(.*)",
+ "i");
+ }
+ else
+ {
+ // 06.07.2010 Update for vidoemo.com video3 and \\\/
+ // slashes before and after might create bugs
+ // 18.12.2010 Update is for vimeo.com : vimeo_clip_
+ // 12.02.2011 Update for myvideo.de. php&ID and \\\. This migth break
+ // 25.02.2011 Update for videoclipsdump.com
+ // player_config\\\.php\\\ must be after vid|
+ // 11.06.2011 Update for theonion.com
+ // \\\/video_embed\\\/...
+ video_id_re = new RegExp (
+
"(\\\"|\\\'|\\\&|\\\?|\\\;|\\\/|\\\.|\\\=)(itemid|clip_id|video_id|"+
+ "vid|player_config\\\.php\\\?v|"+
+ "videoid|media_id|vkey|video3|_videoid|"+
+ "vimeo_clip_|php&ID|\\\/video_embed\\\/\\\?id)"+
+ "(\\\"|\\\')*(\\\=|\\\:|,|\\\/)\\\s*(\\\"|\\\')*"+
+ "([a-zA-Z0-9\\\-\\\_]+)",
"i");
+ }
var video_id =data.match(video_id_re);
Modified: branches/0.0.9/src/lm_remove_plugin_install_warning.js
===================================================================
--- branches/0.0.9/src/lm_remove_plugin_install_warning.js 2011-06-14
16:14:24 UTC (rev 91)
+++ branches/0.0.9/src/lm_remove_plugin_install_warning.js 2011-06-14
16:20:26 UTC (rev 92)
@@ -122,7 +122,10 @@
}
// FIXME Temporary fix for Blip.tv. Will replace the HTML5
- // player, otherwise two are visible.
+ // player, otherwise two are visible. 14.06.2011 With the
+ // changes in Blip.tv design and logic, I am unable to find
+ // how to turn HTML5 and test this. I always get the flash
+ // player.
if (/blip\.tv/i.test(window.location.hostname))
{
if (node.parentNode)
Modified: branches/0.0.9/src/lm_site_bliptv.js
===================================================================
--- branches/0.0.9/src/lm_site_bliptv.js 2011-06-14 16:14:24 UTC (rev 91)
+++ branches/0.0.9/src/lm_site_bliptv.js 2011-06-14 16:20:26 UTC (rev 92)
@@ -27,33 +27,57 @@
// END OF LICENSE HEADER
-// Extracts hd links form Blip.tv
-LinternaMagica.prototype.extract_bliptv_hd_links = function()
+// Makes a JSONP request that fetches the clip data in Blip.tv
+LinternaMagica.prototype.request_bliptv_jsonp_data =
+function (object_data)
{
- var holder = document.getElementById("SelectFormat");
+ var jsonp_request_data = new Object();
- if (!holder)
- return null;
+ jsonp_request_data.frame_id = "bliptv_jsonp_data_fetcher";
+ jsonp_request_data.parser_timeout = this.bliptv_jsonp_timeout;
+ jsonp_request_data.parser_timeout_counter =
+ this.bliptv_jsonp_timeout_counter;
+ jsonp_request_data.jsonp_script_link =
+ "http://blip.tv/players/episode/"+object_data.video_id+
+ "?skin=json&callback=bliptv_video_data&version=2";
+ jsonp_request_data.jsonp_function = "bliptv_video_data";
+ jsonp_request_data.parser_function = this.parse_bliptv_jsonp_data;
+ jsonp_request_data.user_data = object_data;
+ this.create_checker_frame(jsonp_request_data);
+}
- // We have only one link
- if (holder.options.length == 2)
- return null;
+// Parses the JSONP data and creates the video object in Blip.tv
+LinternaMagica.prototype.parse_bliptv_jsonp_data = function(data, object_data)
+{
+ // The useful object is inside two arrays
+ data = data[0][0];
+ object_data.link = data.mediaUrl;
var hd_links = new Array();
- // option zero is just a message, no link there
- for (var op=1; op<holder.options.length; op++)
+ // Sort the HD links by width so they are ordered in the HD link
+ // list bottom to top , low to high.
+ var sort_fun = function(a, b)
{
- var link_data = holder.options[op];
+ return ((a.width > b.width) ? -1 :
+ (a.width < b.width) ? 1 :0);
+ };
+
+ data.additionalMedia.sort(sort_fun);
+
+ for (var i=0, l=data.additionalMedia.length; i<l; i++)
+ {
+ var link_data = data.additionalMedia[i];
var link = new Object();
- link.label = link_data.text;
- var raw_url = link_data.value.split(/=/);
- link.url = "http://blip.tv/file/get/"+raw_url[raw_url.length-1]+
- "?referrer=blip.tv&source=1&use_direct=1&use_documents=1";
+ link.url = link_data.url;
+ link.label = link_data.role+
+ " ("+link_data.width+"x"+link_data.height+")";
hd_links.push(link);
}
- return hd_links;
+ object_data.hd_links = hd_links;
+ this.create_video_object(object_data);
}
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [linterna-magica-commit] [92] Merging Blip.tv support from trunk r90.,
Ivaylo Valkov <=