Video Thumbnails - Version 2.0.5

Version Description

  • Added support for Blip URLs
Download this release

Release Info

Developer sutherlandboswell
Plugin Icon 128x128 Video Thumbnails
Version 2.0.5
Comparing to
See all releases

Code changes from version 2.0.4 to 2.0.5

php/providers/class-blip-thumbnails.php CHANGED
@@ -35,25 +35,33 @@ class Blip_Thumbnails extends Video_Thumbnails_Providers {
35
 
36
  // Regex strings
37
  public $regexes = array(
38
- '#http://blip\.tv/play/([^.]+)\.#' // Embed URL
39
  );
40
 
41
  // Thumbnail URL
42
- public function get_thumbnail_url( $id ) {
43
- $request = "http://blip.tv/players/episode/$id?skin=rss";
44
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
45
  if( is_wp_error( $response ) ) {
46
  $result = new WP_Error( 'blip_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
47
  } else {
48
- $xml = new SimpleXMLElement( $response['body'] );
49
- $result = $xml->xpath( "/rss/channel/item/media:thumbnail/@url" );
50
- $result = (string) $result[0]['url'];
 
 
 
51
  }
52
  return $result;
53
  }
54
 
55
  // Test cases
56
  public $test_cases = array(
 
 
 
 
 
57
  array(
58
  'markup' => '<iframe src="http://blip.tv/play/AYL1uFkC.html?p=1" width="780" height="438" frameborder="0" allowfullscreen></iframe><embed type="application/x-shockwave-flash" src="http://a.blip.tv/api.swf#AYL1uFkC" style="display:none"></embed>',
59
  'expected' => 'http://a.images.blip.tv/ReelScience-TheScientificMethodOfOz139.jpg',
35
 
36
  // Regex strings
37
  public $regexes = array(
38
+ '#(https?\:\/\/blip\.tv\/[^\r\n\'\"]+)#' // Blip URL
39
  );
40
 
41
  // Thumbnail URL
42
+ public function get_thumbnail_url( $url ) {
43
+ $request = "http://blip.tv/oembed?url=$url";
44
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
45
  if( is_wp_error( $response ) ) {
46
  $result = new WP_Error( 'blip_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
47
  } else {
48
+ $json = json_decode( $response['body'] );
49
+ if ( isset( $json->error ) ) {
50
+ $result = new WP_Error( 'blip_invalid_url', __( 'Error retrieving video information for <a href="' . $url . '">' . $url . '</a>. Check to be sure this is a valid Blip video URL.' ) );
51
+ } else {
52
+ $result = $json->thumbnail_url;
53
+ }
54
  }
55
  return $result;
56
  }
57
 
58
  // Test cases
59
  public $test_cases = array(
60
+ array(
61
+ 'markup' => 'http://blip.tv/cranetv/illustrator-katie-scott-6617917',
62
+ 'expected' => 'http://a.images.blip.tv/CraneTV-IllustratorKatieScott610.jpg',
63
+ 'name' => 'Video URL'
64
+ ),
65
  array(
66
  'markup' => '<iframe src="http://blip.tv/play/AYL1uFkC.html?p=1" width="780" height="438" frameborder="0" allowfullscreen></iframe><embed type="application/x-shockwave-flash" src="http://a.blip.tv/api.swf#AYL1uFkC" style="display:none"></embed>',
67
  'expected' => 'http://a.images.blip.tv/ReelScience-TheScientificMethodOfOz139.jpg',
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://wie.ly/u/donate
4
  Tags: Video, Thumbnails, YouTube, Vimeo, Blip, Justin.tv, Dailymotion, Metacafe, Image, Featured Image, Post Thumbnail
5
  Requires at least: 3.1
6
  Tested up to: 3.5.1
7
- Stable tag: 2.0.4
8
 
9
  Video Thumbnails simplifies the process of automatically displaying video thumbnails in your WordPress template.
10
 
@@ -96,6 +96,9 @@ The Vimeo API has a rate limit, so in rare cases you may exceed this limit. Try
96
 
97
  == Changelog ==
98
 
 
 
 
99
  = 2.0.4 =
100
  * Fixed bug with file names when the post title uses non-latin characters
101
 
4
  Tags: Video, Thumbnails, YouTube, Vimeo, Blip, Justin.tv, Dailymotion, Metacafe, Image, Featured Image, Post Thumbnail
5
  Requires at least: 3.1
6
  Tested up to: 3.5.1
7
+ Stable tag: 2.0.5
8
 
9
  Video Thumbnails simplifies the process of automatically displaying video thumbnails in your WordPress template.
10
 
96
 
97
  == Changelog ==
98
 
99
+ = 2.0.5 =
100
+ * Added support for Blip URLs
101
+
102
  = 2.0.4 =
103
  * Fixed bug with file names when the post title uses non-latin characters
104
 
video-thumbnails.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://refactored.co/plugins/video-thumbnails
5
  Description: Automatically retrieve video thumbnails for your posts and display them in your theme. Currently supports YouTube, Vimeo, Facebook, Blip.tv, Justin.tv, Dailymotion, Metacafe, Wistia, Youku, Funny or Die, and MPORA.
6
  Author: Sutherland Boswell
7
  Author URI: http://sutherlandboswell.com
8
- Version: 2.0.4
9
  License: GPL2
10
  */
11
  /* Copyright 2013 Sutherland Boswell (email : sutherland.boswell@gmail.com)
@@ -28,7 +28,7 @@ License: GPL2
28
 
29
  define( 'VIDEO_THUMBNAILS_PATH', dirname(__FILE__) );
30
  define( 'VIDEO_THUMBNAILS_FIELD', '_video_thumbnail' );
31
- define( 'VIDEO_THUMBNAILS_VERSION', '2.0.4' );
32
 
33
  // Providers
34
  require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-providers.php' );
5
  Description: Automatically retrieve video thumbnails for your posts and display them in your theme. Currently supports YouTube, Vimeo, Facebook, Blip.tv, Justin.tv, Dailymotion, Metacafe, Wistia, Youku, Funny or Die, and MPORA.
6
  Author: Sutherland Boswell
7
  Author URI: http://sutherlandboswell.com
8
+ Version: 2.0.5
9
  License: GPL2
10
  */
11
  /* Copyright 2013 Sutherland Boswell (email : sutherland.boswell@gmail.com)
28
 
29
  define( 'VIDEO_THUMBNAILS_PATH', dirname(__FILE__) );
30
  define( 'VIDEO_THUMBNAILS_FIELD', '_video_thumbnail' );
31
+ define( 'VIDEO_THUMBNAILS_VERSION', '2.0.5' );
32
 
33
  // Providers
34
  require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-providers.php' );