1
0

Added reading of filelist.html file from disk.

This commit is contained in:
Alexander Andreev 2023-02-19 21:18:36 +04:00
parent cac1ad56fb
commit 182a4c02c9
Signed by: Arav
GPG Key ID: 0388CC8FAA51063F
5 changed files with 10 additions and 7 deletions

View File

@ -50,6 +50,7 @@ func main() {
srv.GET("/status", hand.Status)
srv.GET("/lastsong", hand.LastSong)
srv.GET("/playlist", hand.Playlist)
srv.GET("/filelist", hand.Filelist)
if !*noLiquidsoap {
liquid, err := radio.NewLiquidsoap(config.Liquidsoap.ExecPath, config.Liquidsoap.ScriptPath)

View File

@ -6,6 +6,7 @@ icecast:
# URL to Icecast's status-json.xsl
url: "http://radio.arav.home.arpa/status-json.xsl"
playlist_path: "/var/log/icecast/playlist.log"
filelist_path: "/srv/radio/filelist.html"
liquidsoap:
executable_path: "/opt/opam/4.14.0/bin/liquidsoap"
script_path: "/etc/dwelling/radio.liq"

View File

@ -26,12 +26,6 @@ server {
proxy_set_header Host $host;
}
location =/filelist {
alias $http_root/shared/radio_filelist.html;
default_type text/html;
}
location =/robots.txt {
alias $http_root/shared/files/radio.robots.txt;
default_type text/html;

View File

@ -14,6 +14,7 @@ type Configuration struct {
URL string `yaml:"url"`
Playlist string `yaml:"playlist_path"`
} `yaml:"icecast"`
FilelistPath string `yaml:"filelist_path"`
Liquidsoap struct {
ExecPath string `yaml:"executable_path"`
ScriptPath string `yaml:"script_path"`

View File

@ -8,6 +8,7 @@ import (
"encoding/json"
"log"
"net/http"
"os"
"time"
)
@ -98,3 +99,8 @@ func (h *Handlers) Playlist(w http.ResponseWriter, _ *http.Request) {
fc, _ := web.AssetsGetFile("radio.arav.top.m3u")
w.Write(fc)
}
func (h *Handlers) Filelist(w http.ResponseWriter, _ *http.Request) {
data, _ := os.ReadFile(h.conf.FilelistPath)
w.Write(data)
}