1
0

In handlers made use of oggtag.ReadFile() func. Also updated func names.

This commit is contained in:
Alexander Andreev 2023-10-02 01:27:14 +04:00
parent c054c3b32e
commit 7cc228968d
Signed by: Arav
GPG Key ID: D22A817D95815393

View File

@ -7,7 +7,6 @@ import (
"fmt"
"log"
"net/http"
"os"
"time"
)
@ -58,17 +57,15 @@ func (dj *DJHandlers) PlaylistNext(w http.ResponseWriter, _ *http.Request) {
log.Println("the end of a playlist has been reached")
} else {
go func() {
f, err := os.Open(nxt)
bs, be, err := oggtag.ReadFile(nxt)
if err != nil {
log.Println("cannot open file \"", nxt, "\" to read tags")
log.Println("cannot read an OGG file", nxt, ":", err)
}
buf := make([]byte, 4096)
f.Read(buf)
song := radio.Song_{
Artist: oggtag.OggGetTag(buf, "artist"),
Title: oggtag.OggGetTag(buf, "title"),
Artist: oggtag.GetTag(bs, "artist"),
Title: oggtag.GetTag(bs, "title"),
Duration: oggtag.GetDuration(bs, be),
MaxListeners: dj.listeners.Current(),
StartAt: time.Now()}
// radio.CheckAndUpdateMostListenedSong(song, currentSong)