This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

radio: update to liquidsoap 2.2.2

+21 -35
+21 -35
2configs/services/radio/radio.liq
··· 5 5 6 6 ## functions 7 7 8 - def stringify_attrs(attrs) = 9 - let json.stringify out = (attrs : [(string * string)] as json.object) 10 - out 11 - end 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 - def current(~protocol, ~headers, ~data, uri) = 67 - http.response(content_type = "application/json", data = stringify_attrs( 68 - !last_metadata 69 - )) 61 + def current(request, response) = 62 + response.data(metadata.json.stringify(last_metadata())) 70 63 end 71 - harbor.http.register("/current", port = port, current) 64 + harbor.http.register(port = port, "/current", current) 72 65 73 - def skip(~protocol, ~headers, ~data, uri) = 66 + def skip(request, response) = 74 67 tracks.skip() 75 - http.response(content_type = "application/json", data = stringify_attrs( 76 - !last_metadata 77 - )) 68 + response.data(metadata.json.stringify(last_metadata())) 78 69 end 79 - harbor.http.register("/skip", method = "POST", port = port, skip) 70 + harbor.http.register(method = "POST", port = port, "/skip", skip) 80 71 81 - def all_tracks(~protocol, ~headers, ~data, uri) = 82 - http.response(content_type = "application/json", data = json.stringify( 83 - all_music.remaining_files() 84 - )) 72 + def all_tracks(request, response) = 73 + response.data(json.stringify(all_music.remaining_files())) 85 74 end 86 - harbor.http.register("/all_tracks", port = port, all_tracks) 75 + harbor.http.register(port = port, "/all_tracks", all_tracks) 87 76 88 - def wish_track(~protocol, ~headers, ~data, uri) = 89 - # disallow process: 90 - if string.match(pattern = '^process:', data) then 91 - http.response(code = 400) 77 + def wish_track(req, response) = 78 + if string.match(pattern = '^process:', req.body()) then 79 + response.status_code(400) 92 80 else 93 81 # TODO report errors back 94 - wish = request.create(data) 82 + wish = request.create(req.body()) 95 83 wishlist.push(wish) 96 - http.response(content_type = "application/json", data = "ok") 84 + response.data("ok") 97 85 end 98 86 end 99 - harbor.http.register("/wish", method = "POST", port = port, wish_track) 87 + harbor.http.register(method = "POST", port = port, "/wish", wish_track) 100 88 101 - def wish_tracklist(~protocol, ~headers, ~data, uri) = 102 - http.response(content_type = "application/json", data = json.stringify( 103 - queue_contents(wishlist.queue()) 104 - )) 89 + def wish_tracklist(request, response) = 90 + response.data(json.stringify(queue_contents(wishlist.queue()))) 105 91 end 106 - harbor.http.register("/wish", port = port, wish_tracklist) 92 + harbor.http.register(port = port, "/wish", wish_tracklist) 107 93 108 - def newsshow(~protocol, ~headers, ~data, uri) = 94 + def newsshow(req, response) = 109 95 news.push(request.create("http://c.r/news.ogg")) 110 - http.response(content_type = "application/json", data = "ok") 96 + response.data("ok") 111 97 end 112 - harbor.http.register("/newsshow", method = "POST", port = port, newsshow) 98 + harbor.http.register(method = "POST", port = port, "/newsshow", newsshow)