twedia

package
v0.0.0-...-f4d7713 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSongs

func GetSongs(a *Music, songsCollectionURL string) error

GetSongs populates the provided Music object with the song database found at the URL `songsCollectionURL`.

func InitSpeaker

func InitSpeaker() error

func SelectSong

func SelectSong(artists *Music) (*Artist, *Album, *Song)

SelectSong asks the user for a song from the artists Music object, and returns pointers to the selected Artist, Album, and Song object within

func SynthesiseText

func SynthesiseText(t string, fn string)

SynthesiseText uses the Google Cloud Text-to-Speech API to generate an MP3 audio file speaking the provided string t, and returns the file name of the created MP3 file. NB. this function requires that a valid Google API credential file is present and referred to by the 'GOOGLE_APPLICATION_CREDENTIALS' environment variable.

Types

type Album

type Album struct {
	Name       string `json:"name"`
	Songs      []Song `json:"songs"`
	TotalSongs int
}

Album is a structure storing the album name and a dynamic array of Song objects to represent the songs present on an album.

type Artist

type Artist struct {
	Artist     string  `json:"artist"`
	Albums     []Album `json:"albums"`
	TotalSongs int
}

Artist is a structure storing the artist name and a dynamic array of Album objects to represent the artist's albums.

type Music

type Music struct {
	Artists    []Artist `json:"artists"`
	TotalSongs int
}

Music is a structure storing a dynamic array within which to store the Artist objects, to be populated by parsing the JSON data file.

type Player

type Player struct {

	// Whether the `Player` will continue playing music once the current track has concluded.
	ContinuingPlayback bool
	// contains filtered or unexported fields
}

func NewPlayer

func NewPlayer() Player

func (*Player) AdjustVolume

func (p *Player) AdjustVolume(deltaVolume float64)

func (*Player) PlayFile

func (p *Player) PlayFile(fn string) error

func (*Player) Skip

func (p *Player) Skip() error

func (*Player) Stop

func (p *Player) Stop() error

func (*Player) TogglePause

func (p *Player) TogglePause()

type Song

type Song struct {
	Title string `json:"title"`
	URL   string `json:"url"`
}

Song is a structure storing the song title and YouTube URL of a song, both as a string.

Jump to

Keyboard shortcuts

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