From 8a4f854fa696366b1708d46faa24995e6895004f Mon Sep 17 00:00:00 2001 From: "Alan J. Pippin" Date: Thu, 17 Apr 2008 20:37:48 -0600 Subject: [PATCH] Added support for embedding videos from new video site: vimeo.com --- ItemAddEmbedVideo.inc | 70 ++++++++++++++++++++++++++++++++- templates/ItemAddEmbedVideo.tpl | 1 + 2 files changed, 70 insertions(+), 1 deletion(-) diff --git a/ItemAddEmbedVideo.inc b/ItemAddEmbedVideo.inc index 6bb160f..0e277a4 100644 --- a/ItemAddEmbedVideo.inc +++ b/ItemAddEmbedVideo.inc @@ -161,6 +161,9 @@ class ItemAddEmbedVideo extends ItemAddPlugin { $myspaceUrlPattern="vids.myspace.com"; $myspaceUrlPattern2="myspacetv.com"; $myspaceThumbnailUrl="http://mediaservices.myspace.com/services/rss.ashx?type=video&videoID="; + + /* vimeo */ + $vimeoUrlPattern="www.vimeo.com"; /* Gallery2 specific paths and variables */ $urlGenerator =& $gallery->getUrlGenerator(); @@ -781,7 +784,72 @@ class ItemAddEmbedVideo extends ItemAddPlugin { return array(GalleryCoreApi::error(ERROR_BAD_PATH,__FILE__,__LINE__, "Unable to extract embedded video information from url: $url"),NULL,NULL); } - + + /* + ********************************** + * Embed a Vimeo Video + ********************************** + */ + } else if(preg_match("/$vimeoUrlPattern/",$url)) { + + /* Make sure we can extract a docID */ + if(preg_match("/$vimeoUrlPattern\/(.*)/",$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); + } + + /* Grab the contents of the webpage used to display the video on video.google.com */ + list ($successfullyCopied, $contents, $response, $headers) = + GalleryCoreApi::fetchWebPage($url, $extraHeaders); + if (!$successfullyCopied) { + return array(GalleryCoreApi::error(ERROR_BAD_PATH,__FILE__,__LINE__, + "Unable to get video information at url: $url - $response"),NULL,NULL); + } + + /* Extract the summary from the webpage contents */ + preg_match('/Stickam: http://www.stickham.com/editMediaComment.do?method=load&mId=xxxxxxxxx
Myspace1: http://vids.myspace.com/index.cfm?fuseaction=vids.individual&VideoID=xxxxxxxx
Myspace2: http://myspacetv.com/index.cfm?fuseaction=vids.individual&videoid=xxxxxxxx
+ Vimeo: http://www.vimeo.com/xxxxxx

Supported File Types:
FlashVideo (.flv): http://aaa.bbb.ccc/video.flv
-- 2.34.1