1
0

A separate executable dwelling-radiodj was removed.

This commit is contained in:
Alexander Andreev 2023-10-02 03:13:39 +04:00
parent f0438ff822
commit 698d7787e6
Signed by: Arav
GPG Key ID: D22A817D95815393
2 changed files with 8 additions and 114 deletions

View File

@ -25,21 +25,20 @@ endif
run: run:
bin/dwelling-radio -listen 127.0.0.1:18322 -mls-file ./mls-test \ bin/dwelling-radio -listen 127.0.0.1:18322 -mls-file ./mls-test \
-ic-url http://radio.arav.home.arpa/status-json.xsl -ic-playlist ./p.log -playlist /mnt/data/appdata/radio/playlists/all-rand
run-dj: run-dj:
bin/dwelling-radiodj -listen 127.0.0.1:18323 -list-length 10 \ bin/dwelling-radiodj -listen 127.0.0.1:18323 -list-length 10 \
-playlist /mnt/data/appdata/radio/playlists/all-rand \
-mls-file ./mls-test -mls-file ./mls-test
install: install:
install -Dm 0755 bin/${TARGET} ${DESTDIR}${PREFIX}/bin/${TARGET} install -Dm 0755 bin/${TARGET} ${DESTDIR}${PREFIX}/bin/${TARGET}
install -Dm 0755 bin/${TARGET}dj ${DESTDIR}${PREFIX}/bin/${TARGET}dj
install -Dm 0755 tools/radioctl ${DESTDIR}${PREFIX}/bin/${TARGET}ctl install -Dm 0755 tools/radioctl ${DESTDIR}${PREFIX}/bin/${TARGET}ctl
install -Dm 0755 tools/radiodj-fetch ${DESTDIR}${PREFIX}/bin/${TARGET}dj-fetch install -Dm 0755 tools/radio-fetch ${DESTDIR}${PREFIX}/bin/${TARGET}-fetch
install -Dm 0755 tools/radiodj-listener-connect ${DESTDIR}${PREFIX}/bin/${TARGET}dj-listener-connect install -Dm 0755 tools/radio-listener-connect ${DESTDIR}${PREFIX}/bin/${TARGET}-listener-connect
install -Dm 0755 tools/radiodj-listener-disconnect ${DESTDIR}${PREFIX}/bin/${TARGET}dj-listener-disconnect install -Dm 0755 tools/radio-listener-disconnect ${DESTDIR}${PREFIX}/bin/${TARGET}dj-listener-disconnect
install -Dm 0644 configs/radio.liq ${DESTDIR}/etc/dwelling/radio.liq install -Dm 0644 configs/radio.liq ${DESTDIR}/etc/dwelling/radio.liq
install -Dm 0644 configs/radio.vars.liq ${DESTDIR}/etc/dwelling/radio.vars.liq install -Dm 0644 configs/radio.vars.liq ${DESTDIR}/etc/dwelling/radio.vars.liq
@ -47,25 +46,22 @@ install:
install -Dm 0644 configs/logrotate ${DESTDIR}/etc/logrotate.d/${TARGET} install -Dm 0644 configs/logrotate ${DESTDIR}/etc/logrotate.d/${TARGET}
install -Dm 0644 init/radio.service ${DESTDIR}/${SYSDDIR}/${TARGET}.service install -Dm 0644 init/radio.service ${DESTDIR}/${SYSDDIR}/${TARGET}.service
install -Dm 0644 init/radiodj.service ${DESTDIR}/${SYSDDIR}/${TARGET}dj.service
install -Dm 0644 init/liquidsoap.service ${DESTDIR}/${SYSDDIR}/${TARGET}-liquidsoap.service install -Dm 0644 init/liquidsoap.service ${DESTDIR}/${SYSDDIR}/${TARGET}-liquidsoap.service
install -Dm 0644 init/ezstream.service ${DESTDIR}/${SYSDDIR}/${TARGET}-ezstream.service install -Dm 0644 init/ezstream.service ${DESTDIR}/${SYSDDIR}/${TARGET}-ezstream.service
uninstall: uninstall:
rm ${DESTDIR}${PREFIX}/bin/${TARGET} rm ${DESTDIR}${PREFIX}/bin/${TARGET}
rm ${DESTDIR}${PREFIX}/bin/${TARGET}dj
rm ${DESTDIR}${PREFIX}/bin/${TARGET}ctl rm ${DESTDIR}${PREFIX}/bin/${TARGET}ctl
rm ${DESTDIR}${PREFIX}/bin/${TARGET}dj-fetch rm ${DESTDIR}${PREFIX}/bin/${TARGET}-fetch
rm ${DESTDIR}${PREFIX}/bin/${TARGET}dj-listener-connect rm ${DESTDIR}${PREFIX}/bin/${TARGET}-listener-connect
rm ${DESTDIR}${PREFIX}/bin/${TARGET}dj-listener-disconnect rm ${DESTDIR}${PREFIX}/bin/${TARGET}-listener-disconnect
rm ${DESTDIR}/etc/dwelling/radio.liq rm ${DESTDIR}/etc/dwelling/radio.liq
rm ${DESTDIR}/etc/dwelling/ezstream.xml rm ${DESTDIR}/etc/dwelling/ezstream.xml
rm ${DESTDIR}/etc/logrotate.d/${TARGET} rm ${DESTDIR}/etc/logrotate.d/${TARGET}
rm ${DESTDIR}${SYSDDIR}/${TARGET}.service rm ${DESTDIR}${SYSDDIR}/${TARGET}.service
rm ${DESTDIR}${SYSDDIR}/${TARGET}dj.service
rm ${DESTDIR}${SYSDDIR}/${TARGET}-liquidsoap.service rm ${DESTDIR}${SYSDDIR}/${TARGET}-liquidsoap.service
rm ${DESTDIR}${SYSDDIR}/${TARGET}-ezstream.service rm ${DESTDIR}${SYSDDIR}/${TARGET}-ezstream.service

View File

@ -1,102 +0,0 @@
package main
import (
ihttp "dwelling-radio/internal/http"
"dwelling-radio/internal/radio"
"flag"
"fmt"
"io/fs"
"log"
"net/http"
"os"
"os/signal"
"syscall"
"git.arav.su/Arav/httpr"
)
var (
listenAddress = flag.String("listen", "/var/run/dwelling-radio/sock", "listen address (ip:port|unix_path)")
playlist = flag.String("playlist", "", "path to a playlist")
songListLen = flag.Int("list-length", 10, "number of songs to show in last N songs table")
mostListenedSongPath = flag.String("mls-file", "/mnt/data/appdata/radio/mostlistenedsong", "path to a file that stores info about the most listened song")
showVersion = flag.Bool("v", false, "show version")
)
var version string
func main() {
flag.Parse()
log.SetFlags(log.Lshortfile)
if *showVersion {
fmt.Println("dwelling-radio ver.", version, "\nCopyright (c) 2023 Alexander \"Arav\" Andreev <me@arav.su>")
return
}
r := httpr.New()
lstnrs := radio.NewListenerCounter()
plylst, err := radio.NewPlaylist(*playlist, true)
if err != nil {
log.Fatalln(err)
}
if data, err := os.ReadFile(*mostListenedSongPath); err == nil {
if err := radio.LoadMostListenedSong(data); err != nil {
log.Fatalln(err)
}
}
djh := ihttp.NewDJHandlers(lstnrs, plylst, *songListLen)
s := r.Sub("/listener")
s.Handler(http.MethodGet, "/", djh.ListenersGet)
s.Handler(http.MethodPost, "/", djh.ListenersInc)
s.Handler(http.MethodDelete, "/", djh.ListenersDec)
r.Handler(http.MethodGet, "/playlist", djh.PlaylistNext)
r.Handler(http.MethodGet, "/song", djh.Song)
r.Handler(http.MethodGet, "/songs", djh.Songs)
r.Handler(http.MethodGet, "/status", djh.Status)
r.Handler(http.MethodGet, "/mostlistenedsong", djh.MostListenedSong)
srv := ihttp.NewHttpServer(r)
if err := srv.Start(*listenAddress); err != nil {
log.Fatalln(err)
}
defer func() {
fileData := radio.StoreMostListenedSong()
if fileData != nil {
err := os.WriteFile(*mostListenedSongPath, fileData, fs.ModePerm)
if err != nil {
log.Println("failed to store a most listened song:", err)
}
}
if err := srv.Stop(); err != nil {
log.Fatalln(err)
}
}()
doneSignal := make(chan os.Signal, 1)
signal.Notify(doneSignal, os.Interrupt, syscall.SIGINT, syscall.SIGTERM, syscall.SIGSEGV)
reloadSignal := make(chan os.Signal, 1)
signal.Notify(reloadSignal, syscall.SIGHUP)
go func() {
for {
<-reloadSignal
plylst.Reload()
}
}()
<-doneSignal
}