mirror of
https://github.com/mpv-player/mpv
synced 2025-01-16 22:37:28 +01:00
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@gmx.de> git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8898 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
05f84f844e
commit
60fe584e08
@ -328,6 +328,50 @@ parse_pls(play_tree_parser_t* p) {
|
||||
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;
|
||||
@ -531,6 +575,10 @@ play_tree_parser_get_play_tree(play_tree_parser_t* 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);
|
||||
|
||||
// Here come the others formats ( textplain must stay the last one )
|
||||
tree = parse_textplain(p);
|
||||
|
Loading…
Reference in New Issue
Block a user