content

package
v0.1.6-beta Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: AGPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PodcastPlayOrderRandom   bool
	PodcastPlayerOrderOldest bool
)
View Source
var MediaTypeMap = map[MediaType]Media{
	// contains filtered or unexported fields
}
View Source
var Shuffled bool

Functions

func HydratePodcastCache

func HydratePodcastCache()

HydratePodcastCache populates the default podcast cache with a local file

Types

type Decoder

type Decoder interface {
	Decode(rc io.ReadCloser) (s beep.StreamSeekCloser, format beep.Format, err error)
}

Decoder is an interface to the beep package.

type Folder

type Folder struct {
	Name    string
	Content []os.DirEntry
	Path    string
}

Folder is a struct for parsing folders that implements the Media interface

func (*Folder) Get

func (f *Folder) Get() (err error)

func (*Folder) Play

func (f *Folder) Play() error

func (*Folder) Stop

func (f *Folder) Stop() error

type LocalFile

type LocalFile struct {
	Name    string
	Content *os.File
	Path    string
	// contains filtered or unexported fields
}

func (*LocalFile) Get

func (l *LocalFile) Get() error

func (*LocalFile) Play

func (l *LocalFile) Play() error

func (*LocalFile) Stop

func (l *LocalFile) Stop() error

type Media

type Media interface {
	Get() error
	Play() error
	Stop() error
}

Media is the interface to represent playing any type of audio.

type MediaType

type MediaType string

type PlayOrder

type PlayOrder string

type Podcast

type Podcast struct {
	Name        string
	URL         string
	Player      streamPlayer
	PlayOrder   PlayOrder
	EpisodeGuid string
	TTL         time.Duration // cache expiration time
}

func (*Podcast) Get

func (p *Podcast) Get() error

Get parses a podcast feed and sets the most recent episode as the Podcast content.

func (*Podcast) Play

func (p *Podcast) Play() error

Play sends the audio to the output. It caches a played episode in the cache ofr later checks.

func (*Podcast) Stop

func (p *Podcast) Stop() error

type Program

type Program struct {
	Name     string
	Source   string
	Timeslot *Timeslot
	Type     MediaType
}

func (*Program) GetMedia

func (p *Program) GetMedia() Media

type Scheduler

type Scheduler struct {
	Content struct {
		// Expire time for played podcast cache
		PlayedPodcastTTL string
		// Duration between the loop pausing and checking the content against the schedule.
		CheckInterval string
		Programs      []*Program
	}
}

func NewScheduler

func NewScheduler(file string) (*Scheduler, error)

func (*Scheduler) Run

func (s *Scheduler) Run() error

func (*Scheduler) Shuffle

func (s *Scheduler) Shuffle() error

Shuffle plays through the config content at random

func (*Scheduler) Stop

func (s *Scheduler) Stop(signal os.Signal, media Media)

type Timeslot

type Timeslot struct {
	Begin string
	End   string
}

Times represents timeslots and are parsed in a 24hour format

func (*Timeslot) IsScheduledNow

func (t *Timeslot) IsScheduledNow(current time.Time) bool

IsScheduledNow checks the current time and returns a bool if the time falls within the range

type WebRadio

type WebRadio struct {
	Name   string
	URL    string
	Player streamPlayer
}

func (*WebRadio) Get

func (w *WebRadio) Get() error

func (*WebRadio) Play

func (w *WebRadio) Play() error

func (*WebRadio) Stop

func (w *WebRadio) Stop() error

Jump to

Keyboard shortcuts

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