X-Git-Url: http://git.pippins.net/embedvideo/.git/?a=blobdiff_plain;f=ItemAddEmbedVideo.inc;h=7ef877ed842a6e270f241eb722ba105c0764ed13;hb=1528ab8803b189ef5118fe23c11dc93bd2b37954;hp=b2a4539dcd45e107c56f12fda9fee21381eb3462;hpb=7cb9aa64e570b7d48718f6eb327448a48a9b77b3;p=embedvideo%2F.git 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];