comparison asxparser.c @ 9744:eceac82103f5

Remove STREAMTYPE_PLAYLIST. Add support for quoting attribs vals with with ' Use new config headers
author albeu
date Sun, 30 Mar 2003 17:02:05 +0000
parents 89a31cf91a05
children 6180d7558f75
comparison
equal deleted inserted replaced
9743:3d32e3e96b67 9744:eceac82103f5
9 #include "playtree.h" 9 #include "playtree.h"
10 #include "playtreeparser.h" 10 #include "playtreeparser.h"
11 #include "libmpdemux/stream.h" 11 #include "libmpdemux/stream.h"
12 #include "asxparser.h" 12 #include "asxparser.h"
13 #include "mp_msg.h" 13 #include "mp_msg.h"
14 #include "cfgparser.h" 14 #include "m_config.h"
15 15
16 extern m_config_t* mconfig; 16 extern m_config_t* mconfig;
17 17
18 ////// List utils 18 ////// List utils
19 19
191 attrib = (char*)malloc(ptr2-ptr1+2); 191 attrib = (char*)malloc(ptr2-ptr1+2);
192 strncpy(attrib,ptr1,ptr2-ptr1+1); 192 strncpy(attrib,ptr1,ptr2-ptr1+1);
193 attrib[ptr2-ptr1+1] = '\0'; 193 attrib[ptr2-ptr1+1] = '\0';
194 194
195 ptr1 = strchr(ptr3,'"'); 195 ptr1 = strchr(ptr3,'"');
196 if(ptr1 == NULL || ptr1[1] == '\0') ptr1 = strchr(ptr3,'\'');
196 if(ptr1 == NULL || ptr1[1] == '\0') { 197 if(ptr1 == NULL || ptr1[1] == '\0') {
197 mp_msg(MSGT_PLAYTREE,MSGL_WARN,"At line %d : can't find attribute %s value",parser->line,attrib); 198 mp_msg(MSGT_PLAYTREE,MSGL_WARN,"At line %d : can't find attribute %s value",parser->line,attrib);
198 free(attrib); 199 free(attrib);
199 break; 200 break;
200 } 201 }
201 ptr1++; 202 ptr2 = strchr(ptr1+1,ptr1[0]);
202 ptr2 = strchr(ptr1,'"');
203 if (ptr2 == NULL) { 203 if (ptr2 == NULL) {
204 mp_msg(MSGT_PLAYTREE,MSGL_WARN,"At line %d : value of attribute %s isn't finished",parser->line,attrib); 204 mp_msg(MSGT_PLAYTREE,MSGL_WARN,"At line %d : value of attribute %s isn't finished",parser->line,attrib);
205 free(attrib); 205 free(attrib);
206 break; 206 break;
207 } 207 }
208 ptr1++;
208 val = (char*)malloc(ptr2-ptr1+1); 209 val = (char*)malloc(ptr2-ptr1+1);
209 strncpy(val,ptr1,ptr2-ptr1); 210 strncpy(val,ptr1,ptr2-ptr1);
210 val[ptr2-ptr1] = '\0'; 211 val[ptr2-ptr1] = '\0';
211 n_attrib++; 212 n_attrib++;
212 213
516 return NULL; 517 return NULL;
517 } 518 }
518 stream=open_stream(href,0,&f); 519 stream=open_stream(href,0,&f);
519 if(!stream) { 520 if(!stream) {
520 mp_msg(MSGT_PLAYTREE,MSGL_WARN,"Can't open playlist %s\n",href); 521 mp_msg(MSGT_PLAYTREE,MSGL_WARN,"Can't open playlist %s\n",href);
521 free(href);
522 return NULL;
523 }
524 if(stream->type != STREAMTYPE_PLAYLIST) {
525 mp_msg(MSGT_PLAYTREE,MSGL_WARN,"URL %s dont point to a playlist\n",href);
526 free_stream(stream);
527 free(href); 522 free(href);
528 return NULL; 523 return NULL;
529 } 524 }
530 525
531 mp_msg(MSGT_PLAYTREE,MSGL_V,"Adding playlist %s to element entryref\n",href); 526 mp_msg(MSGT_PLAYTREE,MSGL_V,"Adding playlist %s to element entryref\n",href);