From: Alan J. Pippin Date: Sat, 13 Sep 2008 03:28:38 +0000 (-0600) Subject: New release 1.1.1: X-Git-Tag: 1_1_1~1 X-Git-Url: http://git.pippins.net/embedvideo/.git/%22%22.%24thumbnail.%22/%7Blink_visit%7D?a=commitdiff_plain;h=1528ab8803b189ef5118fe23c11dc93bd2b37954;p=embedvideo%2F.git New release 1.1.1: - Fixed mypsace video parsing issues - Added new .mp4 remote video type - Added new youtube.com/v/ supported url --- diff --git a/ItemAddEmbedVideo.inc b/ItemAddEmbedVideo.inc index b2a4539..7ef877e 100644 --- a/ItemAddEmbedVideo.inc +++ b/ItemAddEmbedVideo.inc @@ -191,6 +191,8 @@ class ItemAddEmbedVideo extends ItemAddPlugin { $extra_params = $matches[2]; } else if (preg_match("/watch\?v=(.*)/",$url,$matches)) { $video_id = $matches[1]; + } else if (preg_match("/v\/(.*)/",$url,$matches)) { + $video_id = $matches[1]; } else { return array(GalleryCoreApi::error(ERROR_BAD_PARAMETER,__FILE__,__LINE__, "Unable to extract video id from url: $url"),null,null); @@ -715,12 +717,21 @@ class ItemAddEmbedVideo extends ItemAddPlugin { if(preg_match('/thumbnail url="(.+?)"/',$video_info, $matches)) { $thumbnail = $matches[1]; } else { - return array(GalleryCoreApi::error(ERROR_BAD_PATH,__FILE__,__LINE__, - "Unable to extract thumbnail information from url: $url"),NULL,NULL); + /* + * Set the thumbnail to some generic jpg image, + * since we can't extract it from the site. + * If no parameter is set, set it to a default value. + */ + if(preg_match("/\w+/", $flvThumbnail)) { + $thumbnail = $flvThumbnail; + } else { + $thumbnail = $gallery2_url.$gallery2_flv_thumbnail; + } } /* Format the description to hold a reference to the embedded video */ - if(preg_match('/(<embed src.+?\/embed>)/', $contents, $matches)) { + if(preg_match('/(<embed src.+?\/embed>)/', $contents, $matches) || + preg_match('/(<embed src.+?\/object>)/', $contents, $matches)) { $description=$matches[1]; $description=preg_replace("/"/","'",$description); $description=preg_replace("/</","<",$description); @@ -841,11 +852,12 @@ class ItemAddEmbedVideo extends ItemAddPlugin { /* ********************************** - * Embed a remote .flv file + * Embed a remote .flv or .mp4 file ********************************** */ - } else if(preg_match("/.*\/(.+?)\.flv/i",$url,$matches)) { - + } else if(preg_match("/.*\/(.+?)\.flv/i",$url,$matches) || + preg_match("/.*\/(.+?)\.mp4/i",$url,$matches)) { + /* Set the title and summary to the name of the file */ $title = $matches[1]; $summary = $matches[1]; diff --git a/module.inc b/module.inc index 27f100b..7754d2d 100644 --- a/module.inc +++ b/module.inc @@ -33,7 +33,7 @@ class EmbedVideoModule extends GalleryModule { $this->setId('embedvideo'); $this->setName($gallery->i18n('Embed Video')); $this->setDescription($gallery->i18n('Add embedded videos from the web')); - $this->setVersion('1.1.0'); + $this->setVersion('1.1.1'); $this->setGroup('import', $gallery->i18n('Import')); $this->setCallbacks('getSiteAdminViews'); $this->setRequiredCoreApi(array(7, 3)); diff --git a/templates/ItemAddEmbedVideo.tpl b/templates/ItemAddEmbedVideo.tpl index a4660a5..4d680a0 100644 --- a/templates/ItemAddEmbedVideo.tpl +++ b/templates/ItemAddEmbedVideo.tpl @@ -21,6 +21,7 @@
Supported Video Sites:
YouTube: http://www.youtube.com/watch?v=xxxxxxxxxxx
+ YouTube: http://www.youtube.com/v/xxxxxxxxxxx
GoogleVideo: http://video.google.com/videoplay?docid=xxxxxxxxxxx
YahooVideo: http://video.yahoo.com/video/play?vid=xxxxxx
Metacafe: http://www.metacafe.com/watch/xxxxxx/xxxxxx