music

package
v0.0.0-...-0d72df9 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PlaybackState

type PlaybackState int
const (
	IDLE PlaybackState = iota
	PLAY
	PAUSE
	UNPAUSE
	SKIP
	SIGNAL // used to signal the end of a stream session
)

type Queue

type Queue struct {
	IsPlaying       bool
	Mutex           sync.RWMutex
	PlaybackState   chan PlaybackState
	VoiceConnection *discordgo.VoiceConnection
	Songs           []Song
}

func New

func New() *Queue

func (*Queue) Add

func (q *Queue) Add(song *Song)

func (*Queue) Cleanup

func (q *Queue) Cleanup(closeChan bool)

func (*Queue) Process

func (q *Queue) Process()

func (*Queue) Shift

func (q *Queue) Shift() *Song

type Song

type Song struct {
	Title       string
	Url         string
	ArtworkUrl  string
	Duration    string
	RequestedBy string
	Position    int
	StreamData  *StreamData
}

func (*Song) BuildMessageEmbed

func (song *Song) BuildMessageEmbed(queued bool) *discordgo.MessageEmbed

func (*Song) Download

func (song *Song) Download() (string, error)

type Stream

type Stream struct {
	Song            *Song
	VoiceConnection *discordgo.VoiceConnection
}

func (*Stream) Stream

func (stream *Stream) Stream(streamSessionChan chan StreamSession)

type StreamData

type StreamData struct {
	Url          string
	MimeType     string
	AudioQuality string
	Bitrate      int
	Readable     io.ReadCloser
}

type StreamSession

type StreamSession struct {
	Error error
	State PlaybackState
}

Jump to

Keyboard shortcuts

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