X-Git-Url: http://git.pippins.net/embedvideo/.git/%EF%BF%BD%EF%BF%BD%EF%BF%BD%EF%BF%BD%EF%BF%BD%01%EF%BF%BD%EF%BF%BD%EF%BF%BD%EF%BF%BD%EF%BF%BD%0F%EF%BF%BD%EF%BF%BD%EF%BF%BD%EF%BF%BD%EF%BF%BD%EF%BF%BD%EF%BF%BD?a=blobdiff_plain;f=ItemAddEmbedVideo.inc;h=e5eecd1552acde47caac0a76b47401ee4c5086a8;hb=f61667e91c20c89758911f384ec30ff9f92c49e1;hp=b8941f60e09fcc5409f20bec9ea527629f35eea1;hpb=2cffc34190c8edafe96dc51859ca3ca13e70ccde;p=embedvideo%2F.git
diff --git a/ItemAddEmbedVideo.inc b/ItemAddEmbedVideo.inc
index b8941f6..e5eecd1 100644
--- a/ItemAddEmbedVideo.inc
+++ b/ItemAddEmbedVideo.inc
@@ -78,10 +78,22 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
$flvThumbnail = $this->getParameter($ItemAddEmbedVideo, 'flvThumbnail');
/* Store other string constants we'll use later */
+
+ /* youtube */
$youtubeUrlPattern="youtube.com";
$youtubeApiUrl="http://www.youtube.com/api2_rest";
+
+ /* google */
$googleUrlPattern="video.google.com";
$googlePlayer="http://video.google.com/googleplayer.swf";
+
+ /* yahoo */
+ $yahooUrlPattern="video.yahoo.com";
+ $yahooThumbnailUrl="http://thmg01.video.search.yahoo.com/image/";
+
+ /* metacafe */
+ $metacafeUrlPattern="metacafe.com";
+ $metacafeThumbnailUrl="http://www.metacafe.com/thumb/";
/* Gallery2 specific paths and variables */
$urlGenerator =& $gallery->getUrlGenerator();
@@ -210,6 +222,94 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
$description.= 'src="'.$googlePlayer.'?docId='.$doc_id.'"> ';
$description.= '';
$description.= "
$summary";
+
+ /*
+ **********************************
+ * Embed a Yahoo Video
+ **********************************
+ */
+ } else if(preg_match("/$yahooUrlPattern/",$url)) {
+
+ /* Make sure we can extract a vidID */
+ if(preg_match("/vid=(.*)/",$url,$matches)) {
+ $vid_id = $matches[1];
+ } else {
+ return array(GalleryCoreApi::error(ERROR_BAD_PARAMETER,__FILE__,__LINE__,
+ "Unable to extract vid 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('/Description:<\/em>
(.+?)<\/p>/', $contents, $matches); + $summary=$matches[1]; + + /* Extract the title from the webpage contents */ + $title="Unknown"; + if(preg_match('/
"; print "\n".$summary."
"; print "$description
";