Documentation
¶
Index ¶
- Constants
- func Execute(ctx context.Context, cfg config.Config) error
- func NewGRPCServer(ctx context.Context, m *Manager, g *GuestService) (*grpc.Server, error)
- type Guest
- type GuestNick
- type GuestService
- func (gs *GuestService) Auth(ctx context.Context, nick GuestNick) (*radio.User, error)
- func (gs *GuestService) CanDo(ctx context.Context, nick GuestNick, action radio.GuestAction) (ok bool, err error)
- func (gs *GuestService) Create(ctx context.Context, nick GuestNick) (*radio.User, string, error)
- func (gs *GuestService) Deauth(ctx context.Context, nick GuestNick) error
- func (gs *GuestService) Do(ctx context.Context, nick GuestNick, action radio.GuestAction) (ok bool, err error)
- type Manager
- func (m *Manager) CloseSubs()
- func (m *Manager) CurrentListeners(ctx context.Context) (eventstream.Stream[radio.Listeners], error)
- func (m *Manager) CurrentSong(ctx context.Context) (eventstream.Stream[*radio.SongUpdate], error)
- func (m *Manager) CurrentStatus(ctx context.Context) (eventstream.Stream[radio.Status], error)
- func (m *Manager) CurrentThread(ctx context.Context) (eventstream.Stream[radio.Thread], error)
- func (m *Manager) CurrentUser(ctx context.Context) (eventstream.Stream[*radio.User], error)
- func (m *Manager) Shutdown()
- func (m *Manager) Status(ctx context.Context) (*radio.Status, error)
- func (m *Manager) UpdateFromStorage(ctx context.Context) error
- func (m *Manager) UpdateListeners(ctx context.Context, listeners radio.Listeners) error
- func (m *Manager) UpdateSong(ctx context.Context, su *radio.SongUpdate) error
- func (m *Manager) UpdateThread(ctx context.Context, thread radio.Thread) error
- func (m *Manager) UpdateUser(ctx context.Context, u *radio.User) error
- type TuneinUpdater
Constants ¶
const ( GUEST_PASSWORD_LENGTH = 20 GUEST_EXPIRE_LOOP_TICK = time.Minute * 5 GUEST_THREAD_LIMIT = 3 GUEST_KILL_LIMIT = 3 )
const ( TUNEIN_PARTNER_ID = "partnerId" TUNEIN_PARTNER_KEY = "partnerKey" TUNEIN_STATION_ID = "id" )
Variables ¶
This section is empty.
Functions ¶
func Execute ¶
Execute executes a manager with the context and configuration given; it returns with any error that occurs; Execution can be interrupted by canceling the context given.
func NewGRPCServer ¶
NewGRPCServer sets up a net/http server ready to serve RPC requests
Types ¶
type Guest ¶
type Guest struct { Nick GuestNick User *radio.User // AuthTime is the time this guest got authorized AuthTime time.Time // HasStreamed indicates if this guest has been "live" on the stream HasStreamed bool // ThreadSets is the amount of times this guest has used their .thread privilege ThreadSets int // KillAttempts is the amount of times this guest has used their .kill privilege KillAttempts int }
type GuestService ¶
type GuestService struct { Authorized map[GuestNick]*Guest // contains filtered or unexported fields }
func NewGuestService ¶
func NewGuestService(ctx context.Context, cfg config.Config, m radio.ManagerService, us radio.UserStorageService) (*GuestService, error)
func (*GuestService) CanDo ¶
func (gs *GuestService) CanDo(ctx context.Context, nick GuestNick, action radio.GuestAction) (ok bool, err error)
func (*GuestService) Deauth ¶
func (gs *GuestService) Deauth(ctx context.Context, nick GuestNick) error
func (*GuestService) Do ¶
func (gs *GuestService) Do(ctx context.Context, nick GuestNick, action radio.GuestAction) (ok bool, err error)
type Manager ¶
type Manager struct { Storage radio.StorageService // contains filtered or unexported fields }
Manager manages shared state between different processes
func NewManager ¶
func NewManager(ctx context.Context, store radio.StorageService, prober audio.Prober, state []byte) (*Manager, error)
NewManager returns a manager ready for use
func (*Manager) CloseSubs ¶
func (m *Manager) CloseSubs()
CloseSubs calls CloseSubs on all internal manager streams
func (*Manager) CurrentListeners ¶
func (*Manager) CurrentSong ¶
func (m *Manager) CurrentSong(ctx context.Context) (eventstream.Stream[*radio.SongUpdate], error)
func (*Manager) CurrentStatus ¶
func (*Manager) CurrentThread ¶
func (*Manager) CurrentUser ¶
func (*Manager) Shutdown ¶
func (m *Manager) Shutdown()
Shutdown calls Shutdown on all internal manager streams
func (*Manager) UpdateListeners ¶
UpdateListeners sets the listener count
func (*Manager) UpdateSong ¶
UpdateSong sets information about the currently playing song
func (*Manager) UpdateThread ¶
UpdateThread sets the current thread information on the front page and chats
type TuneinUpdater ¶
type TuneinUpdater struct {
// contains filtered or unexported fields
}
func NewTuneinUpdater ¶
func NewTuneinUpdater(ctx context.Context, cfg config.Config, manager radio.ManagerService, client *http.Client) (*TuneinUpdater, error)
func (*TuneinUpdater) Close ¶
func (tu *TuneinUpdater) Close() error
func (*TuneinUpdater) Update ¶
func (tu *TuneinUpdater) Update(ctx context.Context, metadata string) error
Update tries to update the tunein api by using the api endpoint documented at https://tunein.com/broadcasters/api/