alpha
Login
or
Join now
hermes.pds.lassul.us
/
superconfig
forked from
lass.pds.lassul.us/superconfig
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
This repository has no description
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
radio: update to liquidsoap 2.2.2
author
lassulus
date
2 years ago
(Nov 25, 2023, 3:13 PM CET)
commit
b72cea5b
b72cea5b7a1b19e823c6046cffb1e2aaf3282320
parent
eba3986c
eba3986c0966480d60ff93dd32ce4d6c45c8679e
+21
-35
1 changed file
Expand all
Collapse all
Unified
Split
2configs
services
radio
radio.liq
+21
-35
2configs/services/radio/radio.liq
View file
Reviewed
···
5
5
6
6
## functions
7
7
8
8
-
def stringify_attrs(attrs) =
9
9
-
let json.stringify out = (attrs : [(string * string)] as json.object)
10
10
-
out
11
11
-
end
12
12
-
13
8
def filter_music(req) =
14
9
filename = request.filename(req)
15
10
if string.match(pattern = '.*/\\.graveyard/.*', filename) then
···
63
58
64
59
interactive.harbor(port = port)
65
60
66
66
-
def current(~protocol, ~headers, ~data, uri) =
67
67
-
http.response(content_type = "application/json", data = stringify_attrs(
68
68
-
!last_metadata
69
69
-
))
61
61
+
def current(request, response) =
62
62
+
response.data(metadata.json.stringify(last_metadata()))
70
63
end
71
71
-
harbor.http.register("/current", port = port, current)
64
64
+
harbor.http.register(port = port, "/current", current)
72
65
73
73
-
def skip(~protocol, ~headers, ~data, uri) =
66
66
+
def skip(request, response) =
74
67
tracks.skip()
75
75
-
http.response(content_type = "application/json", data = stringify_attrs(
76
76
-
!last_metadata
77
77
-
))
68
68
+
response.data(metadata.json.stringify(last_metadata()))
78
69
end
79
79
-
harbor.http.register("/skip", method = "POST", port = port, skip)
70
70
+
harbor.http.register(method = "POST", port = port, "/skip", skip)
80
71
81
81
-
def all_tracks(~protocol, ~headers, ~data, uri) =
82
82
-
http.response(content_type = "application/json", data = json.stringify(
83
83
-
all_music.remaining_files()
84
84
-
))
72
72
+
def all_tracks(request, response) =
73
73
+
response.data(json.stringify(all_music.remaining_files()))
85
74
end
86
86
-
harbor.http.register("/all_tracks", port = port, all_tracks)
75
75
+
harbor.http.register(port = port, "/all_tracks", all_tracks)
87
76
88
88
-
def wish_track(~protocol, ~headers, ~data, uri) =
89
89
-
# disallow process:
90
90
-
if string.match(pattern = '^process:', data) then
91
91
-
http.response(code = 400)
77
77
+
def wish_track(req, response) =
78
78
+
if string.match(pattern = '^process:', req.body()) then
79
79
+
response.status_code(400)
92
80
else
93
81
# TODO report errors back
94
94
-
wish = request.create(data)
82
82
+
wish = request.create(req.body())
95
83
wishlist.push(wish)
96
96
-
http.response(content_type = "application/json", data = "ok")
84
84
+
response.data("ok")
97
85
end
98
86
end
99
99
-
harbor.http.register("/wish", method = "POST", port = port, wish_track)
87
87
+
harbor.http.register(method = "POST", port = port, "/wish", wish_track)
100
88
101
101
-
def wish_tracklist(~protocol, ~headers, ~data, uri) =
102
102
-
http.response(content_type = "application/json", data = json.stringify(
103
103
-
queue_contents(wishlist.queue())
104
104
-
))
89
89
+
def wish_tracklist(request, response) =
90
90
+
response.data(json.stringify(queue_contents(wishlist.queue())))
105
91
end
106
106
-
harbor.http.register("/wish", port = port, wish_tracklist)
92
92
+
harbor.http.register(port = port, "/wish", wish_tracklist)
107
93
108
108
-
def newsshow(~protocol, ~headers, ~data, uri) =
94
94
+
def newsshow(req, response) =
109
95
news.push(request.create("http://c.r/news.ogg"))
110
110
-
http.response(content_type = "application/json", data = "ok")
96
96
+
response.data("ok")
111
97
end
112
112
-
harbor.http.register("/newsshow", method = "POST", port = port, newsshow)
98
98
+
harbor.http.register(method = "POST", port = port, "/newsshow", newsshow)