commit 5565f491ca62b3fc2a4081aa6cd7f072c976865b
parent 79e1e7d4c0f3bd60dbdf6285f44498311af23d0b
Author: libredev <libredev@ircforever.org>
Date: Fri, 20 Jan 2023 13:55:10 +0530
fix stream url
Diffstat:
M | main.c | | | 20 | +++++++++++++++++--- |
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/main.c b/main.c
@@ -19,6 +19,8 @@
#include "http.h"
#include "pdjson/pdjson.h"
+static const char BASE_URL[] = "https://theinterlude.live";
+
struct icestats {
char *admin;
char *host;
@@ -172,6 +174,18 @@ source_set(struct source *s, json_stream *json, const char *key)
strcpy(s->url, "/stream/");
strcat(s->url, s->server_name);
format_to_url(s->url);
+ } else if (var == &s->listenurl) {
+ char *url;
+ int i;
+
+ url = s->listenurl;
+ for (i = 0; i < 3; i++) {
+ if ((url = strchr(++url, '/')) == NULL)
+ fatal("invalid listenurl: %s\n", s->listenurl);
+ }
+ url = strdup(url);
+ free(*var);
+ *var = url;
}
}
}
@@ -184,9 +198,9 @@ source_print(struct source *s)
/* thumbnail and player */
puts("<div class='player'>");
puts("<img src='/music.svg' alt='thumbnail' width='256' height='256'>");
- puts("<audio controls>");
- /* printf("<source src='%s' type='application/ogg'>\n", s->listenurl); */
- puts("<source src='https://theinterlude.live/autodj' type='application/ogg'>");
+ puts("<audio controls='controls' preload='none'>");
+ /* puts("<source src='https://theinterlude.live/autodj' type='application/ogg'>"); */
+ printf("<source src='%s%s' type='application/ogg'>\n", BASE_URL, s->listenurl);
puts("Your browser does not support the video tag.");
puts("</audio>");
puts("</div>");