[Mplayer-cvslog] CVS: main playtreeparser.c,1.14,1.15

Arpi of Ize arpi at mplayerhq.hu
Sat Jan 11 22:01:51 CET 2003


Update of /cvsroot/mplayer/main
In directory mail:/var/tmp.root/cvs-serv32309

Modified Files:
	playtreeparser.c 
Log Message:
This patch adds support for some silly ini-style-playlist-file-format ...
It starts with [Reference] and entries are:
Ref<n>=<url>

patch by Fabian Franz <FabianFranz at gmx.de>


Index: playtreeparser.c
===================================================================
RCS file: /cvsroot/mplayer/main/playtreeparser.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- playtreeparser.c	12 Nov 2002 01:56:21 -0000	1.14
+++ playtreeparser.c	11 Jan 2003 21:01:48 -0000	1.15
@@ -328,6 +328,50 @@
   return entry;
 }
 
+/*
+ Reference Ini-Format: Each entry is assumed a reference
+ */
+play_tree_t*
+parse_ref_ini(play_tree_parser_t* p) {
+  char *line,*v;
+  play_tree_t *list = NULL, *entry = NULL;
+
+  mp_msg(MSGT_PLAYTREE,MSGL_V,"Trying reference-ini playlist...\n");
+  line = play_tree_parser_get_line(p);
+  strstrip(line);
+  if(strcasecmp(line,"[Reference]"))
+    return NULL;
+  mp_msg(MSGT_PLAYTREE,MSGL_V,"Detected reference-ini playlist format\n");
+  play_tree_parser_stop_keeping(p);
+  line = play_tree_parser_get_line(p);
+  if(!line)
+    return NULL;
+  while(line) {
+    strstrip(line);
+    if(strncasecmp(line,"Ref",3) == 0) {
+      v = pls_entry_get_value(line+3);
+      if(!v)
+	mp_msg(MSGT_PLAYTREE,MSGL_ERR,"No value in entry %s\n",line);
+      else
+      {
+        mp_msg(MSGT_PLAYTREE,MSGL_DBG2,"Adding entry %s\n",v);
+        entry = play_tree_new();
+        play_tree_add_file(entry,v);
+        if(list)
+  	  play_tree_append_entry(list,entry);
+        else
+  	  list = entry;
+      }
+    }
+    line = play_tree_parser_get_line(p);
+  }
+
+  if(!list) return NULL;
+  entry = play_tree_new();
+  play_tree_set_child(entry,list);	
+  return entry;
+}
+
 play_tree_t*
 parse_m3u(play_tree_parser_t* p) {
   char* line;
@@ -529,6 +573,10 @@
     play_tree_parser_reset(p);
 
     tree = parse_m3u(p);
+    if(tree) break;
+    play_tree_parser_reset(p);
+    
+    tree = parse_ref_ini(p);
     if(tree) break;
     play_tree_parser_reset(p);
 



More information about the MPlayer-cvslog mailing list