From a4311fa8fc9115fe2d5821aa25f38b0025505b26 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 7 Dec 2009 12:46:04 -0500 Subject: [PATCH] Added the OGG/Vorbis format parsing to Bliptv. Created a test case for the OGG/Vorbis parsing. Renamed an existing Bliptv test which was copied incorrectly. --- src/websites/bliptv.rb | 10 +- test/bliptv_test.rb | 21 +- test/fixtures/bliptv/2788616.htm | 867 +++++++++++++++++++++++++++++++ 3 files changed, 895 insertions(+), 3 deletions(-) create mode 100644 test/fixtures/bliptv/2788616.htm diff --git a/src/websites/bliptv.rb b/src/websites/bliptv.rb index 9322356..74f656d 100644 --- a/src/websites/bliptv.rb +++ b/src/websites/bliptv.rb @@ -48,6 +48,14 @@ class Bliptv < Website return matches[1] end + # I've seen some free software videos encoded as OGG/Vorbis, too. + video_url_regex = /"Ogg Theora\/Vorbis \(\.ogg\)", "attribute" : "(.*?\.ogg)/i + matches = video_url_regex.match(page_data) + + if not matches.nil? + return matches[1] + end + # If that didn't work, try the WMV format, which is occasionally # used for the source as well. video_url_regex = /"Windows Media \(\.wmv\)", "attribute" : "(.*?\.wmv)/i @@ -60,7 +68,7 @@ class Bliptv < Website # If neither of the source formats are present, just grab the # video URL from the Flash variable and be done with it. - video_url_regex = /setPrimaryMediaUrl\("(.*?\.(flv|mov|wmv|mp4))/i + video_url_regex = /setPrimaryMediaUrl\("(.*?\.(flv|mov|wmv|mp4|ogg))/i matches = video_url_regex.match(page_data) if matches.nil? diff --git a/test/bliptv_test.rb b/test/bliptv_test.rb index 8a763fe..ef2d84a 100644 --- a/test/bliptv_test.rb +++ b/test/bliptv_test.rb @@ -129,8 +129,8 @@ class BliptvTest < Test::Unit::TestCase end - def test_parse_mp4_video_url - # And why not check one of the MP4 pages, too? + def test_parse_default_video_url + # Check one of the pages without alternatives. btv = Bliptv.new(nil) @@ -143,5 +143,22 @@ class BliptvTest < Test::Unit::TestCase test_result = btv.send('parse_video_url', page_data) assert_equal('http://blip.tv/file/get/Kantel-UbiUndPythonDemo816.flv', test_result) end + + + def test_parse_ogg_video_url + # Make sure the OGG/Vorbis parsing works. + + btv = Bliptv.new(nil) + + page_data = nil + + File.open('test/fixtures/bliptv/2788616.htm') do |f| + page_data = f.read + end + + test_result = btv.send('parse_video_url', page_data) + assert_equal('http://blip.tv/file/get/Fosslc-StateOfPostGIS596.ogg', test_result) + end + end diff --git a/test/fixtures/bliptv/2788616.htm b/test/fixtures/bliptv/2788616.htm new file mode 100644 index 0000000..fafd4d8 --- /dev/null +++ b/test/fixtures/bliptv/2788616.htm @@ -0,0 +1,867 @@ + + + + + + + + + + + + + State of PostGIS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + +
+ +
+ + + + + + + + + + +
+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+
State of PostGIS
+
+
+
+
+ +
+ + + +
+
+ +
+ +
+ + + State of PostGIS by Paul Ramsey +
+
+
+ + Play episode as : + +
+
+
+
+
+ +
+ +
+
+
+ Oh, look at that. +
+ +
+ No one has commented yet. Be the first! +
+
+
+
+ + +
+ + +
+
+
+
+
+
+
+ Hey! You must be logged in to add comments. Login or Register. +
+
+
+
+ + + + + +
+ +
+ +
+
+
+
+ +
+ +
+
+
+
You've reached the newest episode.
+
+
+
+
+
+
You've reached the oldest episode.
+
+
+ +
+ + +
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+ +
+ +
+ + + + + + + +
+
+ +
+
+
+
+ + + + + + + + + + + +
+ + + + + +
   + +
+ + +
+
+ + + + + + + + + + + + -- 2.43.2