v1

package
v0.0.0-...-5be94a9 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestTrackArgument  = "trackid"
	RequestSourceArgument = "s"
)
View Source
const (
	SUBSCRIBE = "subscribe"
	SEND      = "send"
	LEAVE     = "leave"
	SHUTDOWN  = "shutdown"
	INIT      = "init"
)
View Source
const (
	EventTime       = "time"
	EventMetadata   = "metadata"
	EventListeners  = "listeners"
	EventStreamer   = "streamer"
	EventQueue      = "queue"
	EventLastPlayed = "lastplayed"
	EventThread     = "thread"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Context   context.Context
	Config    Config
	Search    radio.SearchService
	Templates templates.Executor
	// contains filtered or unexported fields
}

func NewAPI

func NewAPI(ctx context.Context, cfg config.Config,
	templates templates.Executor,
	fs afero.Fs,
	songSecret secret.Secret) (*API, error)

func (*API) GetSong

func (a *API) GetSong(w http.ResponseWriter, r *http.Request)

func (*API) PostRequest

func (a *API) PostRequest(w http.ResponseWriter, r *http.Request)

func (*API) Route

func (a *API) Route(r chi.Router)

func (*API) SearchHTML

func (a *API) SearchHTML(w http.ResponseWriter, r *http.Request)

func (*API) Shutdown

func (a *API) Shutdown() error

type Config

type Config struct {
	UserRequestDelay func() time.Duration
	MusicPath        func() string
}

func NewConfig

func NewConfig(cfg config.Config) Config

type EventName

type EventName = string

type LastPlayed

type LastPlayed []radio.Song

LastPlayed is for the lastplayed listing on the home page

func (LastPlayed) TemplateBundle

func (LastPlayed) TemplateBundle() string

func (LastPlayed) TemplateName

func (LastPlayed) TemplateName() string

type Listeners

type Listeners radio.Listeners

Listeners is for the listener amount indicator on the home page

func (Listeners) TemplateBundle

func (Listeners) TemplateBundle() string

func (Listeners) TemplateName

func (Listeners) TemplateName() string

type NowPlaying

type NowPlaying radio.Status

NowPlaying is for what is currently playing on the home page

func (NowPlaying) TemplateBundle

func (NowPlaying) TemplateBundle() string

func (NowPlaying) TemplateName

func (NowPlaying) TemplateName() string

type Queue

type Queue radio.Queue

Queue is for the queue listing on the home page

func (Queue) Length

func (q Queue) Length() time.Duration

func (Queue) Limit

func (q Queue) Limit(maxSize int) Queue

func (Queue) RequestAmount

func (q Queue) RequestAmount() int

func (Queue) TemplateBundle

func (Queue) TemplateBundle() string

func (Queue) TemplateName

func (Queue) TemplateName() string

type SearchInput

type SearchInput struct {
	public.SearchSharedInput
}

func (SearchInput) TemplateBundle

func (SearchInput) TemplateBundle() string

func (SearchInput) TemplateName

func (SearchInput) TemplateName() string

type Stream

type Stream struct {
	// contains filtered or unexported fields
}

func NewStream

func NewStream(ctx context.Context, exec templates.Executor) *Stream

func (*Stream) MessageCache

func (s *Stream) MessageCache(event EventName, data templates.TemplateSelectable) func(r *http.Request) ([]byte, error)

func (*Stream) NewMessage

func (s *Stream) NewMessage(ctx context.Context, event EventName, data templates.TemplateSelectable) message

func (*Stream) SendEvent

func (s *Stream) SendEvent(event EventName, m message)

SendEvent sends an SSE event with the data given.

func (*Stream) SendLastPlayed

func (s *Stream) SendLastPlayed(ctx context.Context, data []radio.Song)

func (*Stream) SendListeners

func (s *Stream) SendListeners(ctx context.Context, data radio.Listeners)

func (*Stream) SendNowPlaying

func (s *Stream) SendNowPlaying(ctx context.Context, data radio.Status)

func (*Stream) SendQueue

func (s *Stream) SendQueue(ctx context.Context, data radio.Queue)

func (*Stream) SendStreamer

func (s *Stream) SendStreamer(ctx context.Context, data radio.User)

func (*Stream) SendThread

func (s *Stream) SendThread(ctx context.Context, data radio.Thread)

func (*Stream) ServeHTTP

func (s *Stream) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler where each client gets send all SSE events that occur after connecting. There is no history.

func (*Stream) Shutdown

func (s *Stream) Shutdown()

Shutdown disconnects all connected clients

type Streamer

type Streamer radio.User

Streamer is for the DJ indicator on the home page

func (Streamer) TemplateBundle

func (Streamer) TemplateBundle() string

func (Streamer) TemplateName

func (Streamer) TemplateName() string

type Thread

type Thread radio.Thread

func (Thread) TemplateBundle

func (Thread) TemplateBundle() string

func (Thread) TemplateName

func (Thread) TemplateName() string

Jump to

Keyboard shortcuts

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