config

package
v0.5.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReqTimeout = 10 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HistoryEntry added in v0.4.0

type HistoryEntry struct {
	Uuid      string    `json:"uuid"`
	Station   string    `json:"station"`
	Song      string    `json:"song"`
	Timestamp time.Time `json:"timestamp"`
}

func (HistoryEntry) Description added in v0.4.0

func (e HistoryEntry) Description() string

func (HistoryEntry) FilterValue added in v0.4.0

func (e HistoryEntry) FilterValue() string

func (HistoryEntry) Title added in v0.4.0

func (e HistoryEntry) Title() string

type Value

type Value struct {
	Version   string   `json:"-"`
	Debug     bool     `json:"-"`
	LogPath   string   `json:"-"`
	Favorites []string `json:"favorites,omitempty"` // Ordered station UUID's for user favorites
	Volume    *int     `json:"volume,omitempty"`
	Theme     int      `json:"theme"`

	History        []HistoryEntry      `json:"history,omitempty"`
	HistorySaveMax *int                `json:"historySaveMax,omitempty"`
	HistoryChan    chan []HistoryEntry `json:"-"`

	AutoplayFavorite string `json:"autoplayFavorite"`

	IsRunning bool `json:"isRunning"`
	// contains filtered or unexported fields
}

func Load

func Load() (cfg *Value, err error)

Load must return a non-nil config Value and an error specifying why it could not read the config file:

- either a default value if no previously saved config is found in the file system

- either the found config Value

func (*Value) AddHistoryEntry added in v0.4.0

func (v *Value) AddHistoryEntry(timestamp time.Time, uuid string, station string, song string)

func (*Value) ClearHistory added in v0.4.0

func (v *Value) ClearHistory()

func (*Value) DeleteFavorite added in v0.3.1

func (v *Value) DeleteFavorite(uuid string) bool

DeleteFavorite returns true if uuid was removed, false if not

func (*Value) DeleteHistoryEntry added in v0.4.0

func (v *Value) DeleteHistoryEntry(delEntry HistoryEntry)

func (*Value) GetVolume added in v0.3.3

func (v *Value) GetVolume() int

func (*Value) InsertFavorite added in v0.3.1

func (v *Value) InsertFavorite(uuid string, idx int) bool

func (*Value) IsFavorite

func (v *Value) IsFavorite(uuid string) bool

func (*Value) Save added in v0.4.2

func (v *Value) Save() error

func (*Value) SetVolume added in v0.3.3

func (v *Value) SetVolume(value int)

func (*Value) String added in v0.4.0

func (v *Value) String() string

func (*Value) ToggleFavorite

func (v *Value) ToggleFavorite(uuid string) bool

ToggleFavorite return true if uuid was added, false if it was removed

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL