In handlers made use of oggtag.ReadFile() func. Also updated func names.
This commit is contained in:
parent
c054c3b32e
commit
7cc228968d
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user