changeset 12300:95ea9f5f6f14

Fix embedded smil playlist detection if there are parameters on the url
author rtognimp
date Mon, 26 Apr 2004 19:33:37 +0000
parents 7cb74aa2ad47
children b80f95e24c96
files playtreeparser.c
diffstat 1 files changed, 16 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/playtreeparser.c	Mon Apr 26 14:41:43 2004 +0000
+++ b/playtreeparser.c	Mon Apr 26 19:33:37 2004 +0000
@@ -11,6 +11,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <unistd.h>
+#include <ctype.h>
 #include "m_config.h"
 #include "playtree.h"
 #include "playtreeparser.h"
@@ -545,7 +546,8 @@
 play_tree_t*
 parse_textplain(play_tree_parser_t* p) {
   char* line;
-  int reflen;
+  char *c;
+  int embedded;
   play_tree_t *list = NULL, *entry = NULL, *last_entry = NULL;
 
   mp_msg(MSGT_PLAYTREE,MSGL_V,"Trying plaintext playlist...\n");
@@ -556,11 +558,19 @@
     if(line[0] == '\0')
       continue;
 
-    //Special check for smil refernce in file
-    reflen=strlen(line);
-    if ( (reflen>5) && (strncasecmp(line+(reflen-5),".smil",5)==0) ) { //embedded playlist link
-      entry=embedded_playlist_parse(line);
-    } else {      //regular file link
+    //Special check for smil reference in file
+    embedded = 0;
+    if (strlen(line) > 5)
+      for(c = line; c[0]; c++ )
+        if((c[0] == '.') && (tolower(c[1]) == 's') && (tolower(c[2])== 'm') && 
+           (tolower(c[3]) == 'i') && (tolower(c[4]) == 'l') &&
+           (!c[5] || c[5] == '?' || c[5] == '&')) {
+          entry=embedded_playlist_parse(line);
+          embedded = 1;
+          break;
+        }
+
+    if (!embedded) {      //regular file link
       entry = play_tree_new();
       play_tree_add_file(entry,line);
     }