static bool_t playlist_load_m3u (const char * path, VFSFile * file, char * * title, Index * filenames, Index * tuples) { char * text = read_win_text (file); if (! text) return FALSE; * title = NULL; char * parse = text; while (parse) { char * next = split_line (parse); while (* parse == ' ' || * parse == '\t') parse ++; if (! * parse) break; if (* parse == '#') goto NEXT; char * s = aud_construct_uri (parse, path); if (s) index_append (filenames, str_get (s)); free (s); NEXT: parse = next; } free (text); return TRUE; }
static bool_t playlist_load_pls (const char * filename, VFSFile * file, char * * title, Index * filenames, Index * tuples) { INIFile * inifile = inifile_read (file); if (! inifile) return FALSE; * title = NULL; const char * val = inifile_lookup (inifile, "playlist", "numberofentries"); if (! val) { inifile_destroy (inifile); return FALSE; } int count = atoi (val); for (int i = 1; i <= count; i ++) { SPRINTF (key, "file%d", i); if (! (val = inifile_lookup (inifile, "playlist", key))) continue; char * uri = aud_construct_uri (val, filename); if (! uri) continue; index_append (filenames, str_get (uri)); free (uri); } inifile_destroy (inifile); return TRUE; }