aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2024-02-10 18:32:19 +0100
committerPřemysl Eric Janouch <p@janouch.name>2024-02-10 18:35:10 +0100
commit9699b80e9d3fc5beb41960836429cb9f352f7083 (patch)
treed744903374f61657cba886ef2259f1c4a2be0661
parent7601a754afd997f83efbf0bd7d01978a51d3df86 (diff)
downloadnncmpp-9699b80e9d3fc5beb41960836429cb9f352f7083.tar.gz
nncmpp-9699b80e9d3fc5beb41960836429cb9f352f7083.tar.xz
nncmpp-9699b80e9d3fc5beb41960836429cb9f352f7083.zip
Very mildly improve stream handling
-rw-r--r--nncmpp.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/nncmpp.c b/nncmpp.c
index 27b3210..0ee6796 100644
--- a/nncmpp.c
+++ b/nncmpp.c
@@ -3843,8 +3843,13 @@ streams_tab_parse_playlist (const char *playlist, const char *content_type,
|| (content_type && is_content_type (content_type, "audio", "x-scpls")))
extract_re = "^File[^=]*=(.+)";
else if ((lines.len && !strcasecmp_ascii (lines.vector[0], "#EXTM3U"))
+ || (content_type && is_content_type (content_type, "audio", "mpegurl"))
|| (content_type && is_content_type (content_type, "audio", "x-mpegurl")))
- extract_re = "^([^#].*)";
+ // This could be "^([^#].*)", however 1. we would need to resolve
+ // relative URIs, and 2. relative URIs probably mean a Media Playlist,
+ // which must be passed to MPD. The better thing to do here would be to
+ // reject anything with EXT-X-TARGETDURATION, and to resolve the URIs.
+ extract_re = "^(https?://.+)";
regex_t *re = regex_compile (extract_re, REG_EXTENDED, NULL);
hard_assert (re != NULL);
@@ -3867,7 +3872,7 @@ streams_tab_extract_links (struct str *data, const char *content_type,
}
streams_tab_parse_playlist (data->str, content_type, out);
- return true;
+ return out->len != 0;
}
static void