changeset 3967:efd7ec36483e

revise check code to handle http:// properly.
author Yoshiki Yazawa <yaz@cc.rim.or.jp>
date Sun, 18 Nov 2007 14:49:52 +0900
parents ecda04452d14
children a4a5bdbdec38 b0ae5dbd2f53
files src/audacious/playlist.c
diffstat 1 files changed, 76 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/playlist.c	Sat Nov 17 06:22:27 2007 -0600
+++ b/src/audacious/playlist.c	Sun Nov 18 14:49:52 2007 +0900
@@ -785,20 +785,22 @@
         return TRUE;
     }
 
-    /* audio file or uri */
-    if (playlist->loading_playlist == TRUE)
+    /* playlist file or remote uri */
+    if (playlist->loading_playlist == TRUE ||
+        str_has_prefix_nocase(filename, "http://") ||
+        str_has_prefix_nocase(filename, "https://")) {
         dec = NULL;
-
-    /* on demand probing is on */
-    if (cfg.playlist_detect == TRUE) { 
+    }
+
+    /* local file and on-demand probing is on */
+    else if (cfg.playlist_detect == TRUE) { 
         dec = NULL;
         if(cfg.use_extension_probing && !filter_by_extension(filename))
             return FALSE;
     }
-    /* find decorder for non-remote uri i.e. local file */
-    else if (!str_has_prefix_nocase(filename, "http://") && 
-        !str_has_prefix_nocase(filename, "https://")) {
-
+
+    /* find decorder for local file */
+    else {
         pr = input_check_file(filename, TRUE);
 
         if (pr) {
@@ -983,7 +985,7 @@
             else
                 list = g_list_prepend(list, filename);
         }
-        else if ((pr = input_check_file(filename, TRUE)) != NULL)
+        else if ((pr = input_check_file(filename, TRUE)) != NULL) /* local file, probing*/
         {
             list = g_list_prepend(list, filename);
 
@@ -1735,32 +1737,47 @@
 
     if (filename[0] != '/' && !strstr(filename, "://")) {
         path = g_strdup(playlist_name);
+
         if ((tmp = strrchr(path, '/')))
             *tmp = '\0';
         else {
-            if ((playlist->loading_playlist == TRUE ||
-                 cfg.playlist_detect == TRUE)) {
+            /* playlist file or remote uri */
+            if (playlist->loading_playlist == TRUE ||
+                str_has_prefix_nocase(filename, "http://") ||
+                str_has_prefix_nocase(filename, "https://")) {
                 pr = NULL;
-                if(!filter_by_extension(filename))
+            }
+            /* local file and on-demand probing is on */
+            else if (cfg.playlist_detect == TRUE) {
+                pr = NULL;
+                if(cfg.use_extension_probing && !filter_by_extension(filename))
                     return;
             }
-            else if (!str_has_prefix_nocase(filename, "http://") && 
-                     !str_has_prefix_nocase(filename, "https://")) {
+            /* find decorder for local file */
+            else {
                 pr = input_check_file(filename, TRUE);
             }
             __playlist_ins_with_info(playlist, filename, pos, title, len, pr ? pr->ip : NULL);
             g_free(pr);
             return;
         }
+
         tmp = g_build_filename(path, filename, NULL);
 
-        if (playlist->loading_playlist == TRUE && cfg.playlist_detect == TRUE) {
+        /* playlist file or remote uri */
+        if (playlist->loading_playlist == TRUE ||
+            str_has_prefix_nocase(tmp, "http://") ||
+            str_has_prefix_nocase(tmp, "https://")) {
             pr = NULL;
-            if(!filter_by_extension(filename))
+        }
+        /* local file and on-demand probing is on */
+        else if (cfg.playlist_detect == TRUE) {
+            pr = NULL;
+            if(cfg.use_extension_probing && !filter_by_extension(filename))
                 return;
         }
-        else if (!str_has_prefix_nocase(tmp, "http://") && 
-                 !str_has_prefix_nocase(tmp, "https://")) {
+        /* find decoder for local file */
+        else {
             pr = input_check_file(tmp, TRUE);
         }
 
@@ -1771,14 +1788,20 @@
     }
     else
     {
-        if ((playlist->loading_playlist == TRUE ||
-             cfg.playlist_detect == TRUE)) {
+        /* playlist file or remote uri */
+        if (playlist->loading_playlist == TRUE ||
+            str_has_prefix_nocase(filename, "http://") ||
+            str_has_prefix_nocase(filename, "https://")) {
             pr = NULL;
-            if(!filter_by_extension(filename))
+        }
+        /* local file and on-demand probing is on */
+        else if (cfg.playlist_detect == TRUE) {
+            pr = NULL;
+            if(cfg.use_extension_probing && !filter_by_extension(filename))
                 return;
         }
-        else if (!str_has_prefix_nocase(filename, "http://") && 
-                 !str_has_prefix_nocase(filename, "https://")) {
+        /* find decoder for local file */
+        else {
             pr = input_check_file(filename, TRUE);
         }
         __playlist_ins_with_info(playlist, filename, pos, title, len, pr ? pr->ip : NULL);
@@ -1814,31 +1837,40 @@
         if ((tmp = strrchr(path, '/')))
             *tmp = '\0';
         else {
-            if ((playlist->loading_playlist == TRUE ||
-                 cfg.playlist_detect == TRUE)) {
+            if (playlist->loading_playlist == TRUE ||
+            str_has_prefix_nocase(filename, "http://") ||
+            str_has_prefix_nocase(filename, "https://")) {
                 pr = NULL;
-                if(!filter_by_extension(filename))
+            }
+            else if (cfg.playlist_detect == TRUE) {
+                pr = NULL;
+                if(cfg.use_extension_probing && !filter_by_extension(filename))
                     return;
             }
-	    else if (!str_has_prefix_nocase(filename, "http://") && 
-	        !str_has_prefix_nocase(filename, "https://"))
-	        pr = input_check_file(filename, TRUE);
+            else {
+                pr = input_check_file(filename, TRUE);
+            }
 
             __playlist_ins_with_info_tuple(playlist, filename, pos, tuple, pr ? pr->ip : NULL);
             g_free(pr);
             return;
         }
+
         tmp = g_build_filename(path, filename, NULL);
 
-        if ((playlist->loading_playlist == TRUE ||
-             cfg.playlist_detect == TRUE)) {
+        if (playlist->loading_playlist == TRUE ||
+            str_has_prefix_nocase(filename, "http://") ||
+            str_has_prefix_nocase(filename, "https://")) {
             pr = NULL;
-            if(!filter_by_extension(filename))
+        }
+        else if (cfg.playlist_detect == TRUE) {
+            pr = NULL;
+            if(cfg.use_extension_probing && !filter_by_extension(filename))
                 return;
         }
-        else if (!str_has_prefix_nocase(filename, "http://") && 
-            !str_has_prefix_nocase(filename, "https://"))
+        else {
             pr = input_check_file(filename, TRUE);
+        }
 
         __playlist_ins_with_info_tuple(playlist, tmp, pos, tuple, pr ? pr->ip : NULL);
         g_free(tmp);
@@ -1847,15 +1879,19 @@
     }
     else
     {
-        if ((playlist->loading_playlist == TRUE ||
-             cfg.playlist_detect == TRUE)) {
+        if (playlist->loading_playlist == TRUE ||
+            str_has_prefix_nocase(filename, "http://") ||
+            str_has_prefix_nocase(filename, "https://")) {
             pr = NULL;
-            if(!filter_by_extension(filename))
+        }
+        else if (cfg.playlist_detect == TRUE) {
+            pr = NULL;
+            if(cfg.use_extension_probing && !filter_by_extension(filename))
                 return;
         }
-        else if (!str_has_prefix_nocase(filename, "http://") && 
-            !str_has_prefix_nocase(filename, "https://"))
+        else {
             pr = input_check_file(filename, TRUE);
+        }
 
         __playlist_ins_with_info_tuple(playlist, filename, pos, tuple, pr ? pr->ip : NULL);
         g_free(pr);