Playlist: Initialization of PlaylistEntries now uses designators.

This commit is contained in:
Fabian Schlenz 2019-11-28 06:19:11 +01:00
parent 6f8683ba9d
commit fcbbdce118

View File

@ -38,7 +38,7 @@ void Playlist::_add_path(String path) {
ext.equals(".mpa"))) { ext.equals(".mpa"))) {
TRACE(" Adding entry %s\n", entry.name()); TRACE(" Adding entry %s\n", entry.name());
String title = filename.substring(0, filename.length() - 4); String title = filename.substring(0, filename.length() - 4);
_files.push_back({entry.name(), title}); _files.push_back({.filename=entry.name(), .title=title});
bool non_ascii_chars = false; bool non_ascii_chars = false;
for(int i=0; i<filename.length(); i++) { for(int i=0; i<filename.length(); i++) {
char c = filename.charAt(i); char c = filename.charAt(i);
@ -71,7 +71,7 @@ void Playlist::_examine_http_url(String url) {
if (ct.startsWith("audio/x-mpegurl")) { if (ct.startsWith("audio/x-mpegurl")) {
_parse_m3u(http); _parse_m3u(http);
} else if (ct.startsWith("audio/")) { } else if (ct.startsWith("audio/")) {
_files.push_back({url, url}); _files.push_back({.filename=url, .title=url});
} else if (ct.startsWith("application/rss+xml")) { } else if (ct.startsWith("application/rss+xml")) {
_parse_rss(http); _parse_rss(http);
} else if (ct.startsWith("application/pls+xml")) { } else if (ct.startsWith("application/pls+xml")) {
@ -173,7 +173,7 @@ void Playlist::_parse_m3u(HTTPClientWrapper* http) {
} }
} else if (line.startsWith("http")) { } else if (line.startsWith("http")) {
if (title.length()==0) title = line; if (title.length()==0) title = line;
_files.push_back({line, title}); _files.push_back({.filename=line, .title=title});
title = ""; title = "";
} }
line = ""; line = "";
@ -215,7 +215,7 @@ void Playlist::_parse_pls(HTTPClientWrapper* http) {
} }
if (title.length()>0 && url.length()>0) { if (title.length()>0 && url.length()>0) {
_files.push_back({url, title}); _files.push_back({.filename=url, .title=title});
last_index = -1; last_index = -1;
title = ""; title = "";
url = ""; url = "";