New release 1.1.1:
authorAlan J. Pippin <ajp@server.pippins.net>
Sat, 13 Sep 2008 03:28:38 +0000 (21:28 -0600)
committerAlan J. Pippin <ajp@pippins.net>
Sat, 13 Sep 2008 03:28:38 +0000 (21:28 -0600)
- Fixed mypsace video parsing issues
- Added new .mp4 remote video type
- Added new youtube.com/v/ supported url

ItemAddEmbedVideo.inc
module.inc
templates/ItemAddEmbedVideo.tpl

index b2a4539dcd45e107c56f12fda9fee21381eb3462..7ef877ed842a6e270f241eb722ba105c0764ed13 100644 (file)
@@ -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('/(&lt;embed src.+?\/embed&gt;)/', $contents, $matches)) { 
+              if(preg_match('/(&lt;embed src.+?\/embed&gt;)/', $contents, $matches) ||
+                 preg_match('/(&lt;embed src.+?\/object&gt;)/', $contents, $matches)) { 
                 $description=$matches[1];
                 $description=preg_replace("/&quot;/","'",$description);
                 $description=preg_replace("/&lt;/","<",$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];
index 27f100b60661c3c1626fd25a59c52357cd129554..7754d2d9473124da7ccbcebb8529e90e229a655d 100644 (file)
@@ -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));
index a4660a54851f935914f37fd97156f94bd2bbf1af..4d680a078f880c1c03d791416732dc21a6c54b16 100644 (file)
@@ -21,6 +21,7 @@
     <br> 
     <b><u>Supported Video Sites:</u></b> <br>
     <b>YouTube:</b> http://www.youtube.com/watch?v=xxxxxxxxxxx<br>
+    <b>YouTube:</b> http://www.youtube.com/v/xxxxxxxxxxx<br>
     <b>GoogleVideo:</b> http://video.google.com/videoplay?docid=xxxxxxxxxxx<br>
     <b>YahooVideo:</b> http://video.yahoo.com/video/play?vid=xxxxxx<br>
     <b>Metacafe:</b> http://www.metacafe.com/watch/xxxxxx/xxxxxx<br>