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("/status", hand.Status)
srv.GET("/lastsong", hand.LastSong) srv.GET("/lastsong", hand.LastSong)
srv.GET("/playlist", hand.Playlist) srv.GET("/playlist", hand.Playlist)
srv.GET("/filelist", hand.Filelist)
if !*noLiquidsoap { if !*noLiquidsoap {
liquid, err := radio.NewLiquidsoap(config.Liquidsoap.ExecPath, config.Liquidsoap.ScriptPath) 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 to Icecast's status-json.xsl
url: "http://radio.arav.home.arpa/status-json.xsl" url: "http://radio.arav.home.arpa/status-json.xsl"
playlist_path: "/var/log/icecast/playlist.log" playlist_path: "/var/log/icecast/playlist.log"
filelist_path: "/srv/radio/filelist.html"
liquidsoap: liquidsoap:
executable_path: "/opt/opam/4.14.0/bin/liquidsoap" executable_path: "/opt/opam/4.14.0/bin/liquidsoap"
script_path: "/etc/dwelling/radio.liq" script_path: "/etc/dwelling/radio.liq"

View File

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

View File

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

View File

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