Let's dynamically calculate bufferSize with 320 bytes per line.
This commit is contained in:
parent
95a6da8f5d
commit
3e513087ca
@ -18,7 +18,7 @@ const (
|
|||||||
IcecastPlaylistDateFormat = "02/Jan/2006:15:04:05 -0700"
|
IcecastPlaylistDateFormat = "02/Jan/2006:15:04:05 -0700"
|
||||||
SongTimeFormat = "2006 15:04-0700"
|
SongTimeFormat = "2006 15:04-0700"
|
||||||
|
|
||||||
bufferSize = 3072
|
bufferSizePerLine = 320
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -103,6 +103,7 @@ func IcecastLastSong(playlistPath string) (*Song, error) {
|
|||||||
func icecastLastPlayedSongs(playlistPath string, n int) ([]Song, error) {
|
func icecastLastPlayedSongs(playlistPath string, n int) ([]Song, error) {
|
||||||
var buf []byte
|
var buf []byte
|
||||||
var offset int64 = 0
|
var offset int64 = 0
|
||||||
|
var bufferSize int64 = int64(n) * bufferSizePerLine
|
||||||
|
|
||||||
playlist, err := os.Open(playlistPath)
|
playlist, err := os.Open(playlistPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user