]> git.sesse.net Git - vlc/commitdiff
videoportals.c: Add metacafe URL support.
authorAntoine Cellerier <dionoea@videolan.org>
Fri, 11 May 2007 23:51:02 +0000 (23:51 +0000)
committerAntoine Cellerier <dionoea@videolan.org>
Fri, 11 May 2007 23:51:02 +0000 (23:51 +0000)
modules/demux/playlist/videoportals.c

index ab1ab4a00e9ab61e4ec03bc8f3a74425c99677f6..718d86c69368616b9d8e04bcd338f3f140356bc2 100644 (file)
@@ -56,6 +56,7 @@ int E_(Import_VideoPortal)( vlc_object_t *p_this )
     byte_t *p_peek;
     int i_peek;
 
+    printf(">>> %s\n", psz_path );
     /* YouTube */
     if( ( psz_cur = strstr( psz_path, "youtube.com" ) ) )
     {
@@ -131,6 +132,31 @@ int E_(Import_VideoPortal)( vlc_object_t *p_this )
                       docid );
         }
     }
+    /* metacafe */
+    else if( ( psz_cur = strstr( psz_path, "metacafe.com" ) ) )
+    {
+        if( strstr( psz_cur, "watch/" ) )
+        {
+            psz_cur = strstr( psz_cur, "watch/" );
+            psz_cur += strlen( "watch/" );
+            if( psz_cur[strlen(psz_cur)-1] == '/' )
+                psz_cur[strlen(psz_cur)-1] = '\0';
+            asprintf( &psz_url, "http://www.metacafe.com/fplayer/%s.swf",
+                      psz_cur );
+        }
+        else if( ( psz_cur = strstr( psz_path, "images.metacafe.com" ) ) )
+        {
+            if( ( psz_cur = strstr( psz_cur, "mediaURL=" ) ) )
+            {
+                char *psz_tmp;
+                psz_cur += strlen( "mediaURL=" );
+                psz_tmp = strchr( psz_cur, '&' );
+                *psz_tmp = 0;
+                psz_url = strdup( psz_cur );
+                *psz_tmp = '&';
+            }
+        }
+    }
 
     if( !psz_url )
     {