mpc-extra/mpd/song.go

32 lines
478 B
Go
Raw Normal View History

2023-08-27 13:16:53 -05:00
package mpd
import "github.com/fhs/gompd/v2/mpd"
type Song struct {
Path string
Attrs mpd.Attrs
stickers []mpd.Sticker
}
func newSong(attrs mpd.Attrs) *Song {
return &Song{
Path: attrs["file"],
Attrs: attrs,
}
}
func (s *Song) GetStickers() ([]mpd.Sticker, error) {
if s.stickers != nil {
return s.stickers, nil
}
if connerror != nil {
return nil, connerror
}
sticks, err := StickersGetFor(s.Path)
s.stickers = sticks
return s.stickers, err
}