player

package
v0.0.36 Latest Latest
Warning

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

Go to latest
Published: May 19, 2024 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const ENDPOINT = "https://api.github.com/repos/Malwarize/retro/releases/latest"

Variables

This section is empty.

Functions

func MusicDecode

func MusicDecode(data []byte) (beep.StreamSeekCloser, beep.Format, error)

MusicDecode decodes MP3 data from a byte slice and returns a StreamSeekCloser and Format.

func StartIPCServer

func StartIPCServer(port string)

Types

type Converter

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

func NewConverter

func NewConverter() (*Converter, error)

func (*Converter) ConvertToMP3

func (c *Converter) ConvertToMP3(inputData []byte) ([]byte, error)

func (*Converter) IsMp3

func (c *Converter) IsMp3(fileData []byte) (bool, error)

type DResults

type DResults string
const (
	DUnknown  DResults = "unknown"
	DDir      DResults = "dir"
	DFile     DResults = "file"
	DQueue    DResults = "queue"
	DPlaylist DResults = "playlist"
	DYoutube  DResults = "youtube"
	DCache    DResults = "cache"
)

type Director

type Director struct {
	Converter *Converter
	Db        *db.Db
	// contains filtered or unexported fields
}

func NewDefaultDirector

func NewDefaultDirector() (*Director, error)

func NewDirector

func NewDirector(db *db.Db) (*Director, error)

func (*Director) Download

func (od *Director) Download(engineName, url string) (*db.Music, error)

func (*Director) GetEngines

func (od *Director) GetEngines() map[string]en.Engine

func (*Director) Register

func (od *Director) Register(engine en.Engine)

func (*Director) Search

func (od *Director) Search(
	engineName, query string,
) ([]shared.SearchResult, error)

type Download added in v0.0.33

type Download struct {
	Assets []asset `json:"assets"`
}

type Music

type Music struct {
	Name   string
	Volume *effects.Volume
	Format beep.Format
	Data   []byte
}

func NewMusic

func NewMusic(
	name string,
	data []byte,
) (*Music, error)

func (*Music) DurationD

func (m *Music) DurationD() time.Duration

func (*Music) DurationN

func (m *Music) DurationN() int

func (*Music) PositionD

func (m *Music) PositionD() time.Duration

func (*Music) PositionN

func (m *Music) PositionN() int

func (*Music) Seek

func (m *Music) Seek(d time.Duration) error

func (*Music) SetPositionD

func (m *Music) SetPositionD(
	d time.Duration,
) error

func (*Music) SetPositionN

func (m *Music) SetPositionN(p int) error

func (*Music) SetVolume

func (m *Music) SetVolume(vp uint8)

func (*Music) Streamer

func (m *Music) Streamer() beep.StreamSeekCloser

type MusicQueue

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

func NewMusicQueue

func NewMusicQueue() *MusicQueue

func (*MusicQueue) Clear

func (q *MusicQueue) Clear()

func (*MusicQueue) Enqueue

func (q *MusicQueue) Enqueue(music Music)

func (*MusicQueue) GetCurrIndex

func (q *MusicQueue) GetCurrIndex() int

func (*MusicQueue) GetCurrMusic

func (q *MusicQueue) GetCurrMusic() *Music

func (*MusicQueue) GetMusicByIndex

func (q *MusicQueue) GetMusicByIndex(index int) *Music

func (*MusicQueue) GetMusicByName

func (q *MusicQueue) GetMusicByName(name string) *Music

func (*MusicQueue) GetTitles

func (q *MusicQueue) GetTitles() []string

func (*MusicQueue) IsEmpty

func (q *MusicQueue) IsEmpty() bool

func (*MusicQueue) QueueNext

func (q *MusicQueue) QueueNext()

func (*MusicQueue) QueuePrev

func (q *MusicQueue) QueuePrev()

func (*MusicQueue) Remove

func (q *MusicQueue) Remove(music *Music)

func (*MusicQueue) SetCurrIndex

func (q *MusicQueue) SetCurrIndex(index int)

func (*MusicQueue) SetCurrrMusic

func (q *MusicQueue) SetCurrrMusic(m *Music)

func (*MusicQueue) Size

func (q *MusicQueue) Size() int

type Player

type Player struct {
	Queue *MusicQueue

	Director *Director
	Tasks    map[string]shared.Task
	Vol      uint8
	// contains filtered or unexported fields
}
var Instance *Player

func GetPlayer

func GetPlayer() *Player

func NewPlayer

func NewPlayer() *Player

func (*Player) AddMusicFromFile

func (p *Player) AddMusicFromFile(
	path string,
	how callback,
) error

func (*Player) AddMusicFromHash added in v0.0.30

func (p *Player) AddMusicFromHash(
	hash string,
	how callback,
) error

func (*Player) AddMusicFromOnline

func (p *Player) AddMusicFromOnline(
	unique string,
	engineName string,
	how callback,
) error

the unique is the unique id of the music in the engine it can be url or id

func (*Player) AddMusicsFromDir

func (p *Player) AddMusicsFromDir(dirPath string, how callback) error

this function is used to play music from a file that is not mp3/ it will convert it to mp3 in temp and add it to the queue

func (*Player) CheckWhatIsThis

func (p *Player) CheckWhatIsThis(unknown string) DResults

func (*Player) CleanCache added in v0.0.30

func (p *Player) CleanCache() error

func (*Player) CreatePlayList

func (p *Player) CreatePlayList(plname string) error

#################### # Playlist methods # ####################

func (*Player) DetectAndAddToPlayList

func (p *Player) DetectAndAddToPlayList(
	plname string,
	unknown string,
) ([]shared.SearchResult, error)

func (*Player) DetectAndPlay

func (p *Player) DetectAndPlay(unknown string) ([]shared.SearchResult, error)

DetectAndPlay if result is empty, it means it detects and plays the music if succeed other wise it returns the search results

func (*Player) DisableTheUpdatePrompt added in v0.0.33

func (p *Player) DisableTheUpdatePrompt(_ int, reply *int) error

func (*Player) GetAvailableMusicOptions

func (p *Player) GetAvailableMusicOptions(unknown string) []shared.SearchResult

func (*Player) GetCachedMusics added in v0.0.30

func (p *Player) GetCachedMusics() ([]shared.NameHash, error)

func (*Player) GetCurrMusicDuration

func (p *Player) GetCurrMusicDuration() time.Duration

func (*Player) GetCurrMusicPosition

func (p *Player) GetCurrMusicPosition() time.Duration

#################### # Player Info # ####################

func (*Player) GetPlayListMusicNames

func (p *Player) GetPlayListMusicNames(plname string) ([]string, error)

func (*Player) GetPlayerStatus

func (p *Player) GetPlayerStatus() shared.Status

func (*Player) GetTheme

func (p *Player) GetTheme() string

func (*Player) IsUpdateAvailable added in v0.0.33

func (p *Player) IsUpdateAvailable(_ int, reply *bool) error

func (*Player) IsUpdatePromptEnabled added in v0.0.33

func (p *Player) IsUpdatePromptEnabled(_ int, reply *bool) error

func (*Player) Next

func (p *Player) Next() error

func (*Player) Pause

func (p *Player) Pause() error

func (*Player) Play

func (p *Player) Play() error

############################ # Core Player methods # ############################

func (*Player) PlayListPlayAll

func (p *Player) PlayListPlayAll(
	plname string,
) error

func (*Player) PlayListPlayMusic

func (p *Player) PlayListPlayMusic(plname string, music shared.IntOrString) error

func (*Player) PlayListsNames

func (p *Player) PlayListsNames() ([]string, error)

func (*Player) Prev

func (p *Player) Prev() error

func (*Player) RPCCleanCache added in v0.0.30

func (p *Player) RPCCleanCache(_ int, reply *int) error

func (*Player) RPCCreatePlayList

func (p *Player) RPCCreatePlayList(name string, reply *int) error

func (*Player) RPCDetectAndAddToPlayList

func (p *Player) RPCDetectAndAddToPlayList(
	args shared.AddToPlayListArgs,
	reply *[]shared.SearchResult,
) error

func (*Player) RPCDetectAndPlay

func (p *Player) RPCDetectAndPlay(query string, reply *[]shared.SearchResult) error

func (*Player) RPCGetCachedMusics added in v0.0.30

func (p *Player) RPCGetCachedMusics(_ int, reply *[]shared.NameHash) error

func (*Player) RPCGetLogs added in v0.0.30

func (p *Player) RPCGetLogs(_ int, reply *[]string) error

func (*Player) RPCGetPlayerStatus

func (p *Player) RPCGetPlayerStatus(_ int, reply *shared.Status) error

func (*Player) RPCGetTheme

func (p *Player) RPCGetTheme(_ int, reply *string) error

func (*Player) RPCNext

func (p *Player) RPCNext(_ int, reply *int) error

func (*Player) RPCPause

func (p *Player) RPCPause(_ int, reply *int) error

func (*Player) RPCPlay

func (p *Player) RPCPlay(_ int, reply *int) error

func (*Player) RPCPlayListMusics

func (p *Player) RPCPlayListMusics(
	plname string,
	reply *[]string,
) error

func (*Player) RPCPlayListPlayAll

func (p *Player) RPCPlayListPlayAll(name string, reply *int) error

func (*Player) RPCPlayListPlayMusic

func (p *Player) RPCPlayListPlayMusic(args shared.PlayListPlayMusicArgs, reply *int) error

func (*Player) RPCPlayListsNames

func (p *Player) RPCPlayListsNames(_ int, reply *[]string) error

func (*Player) RPCPrev

func (p *Player) RPCPrev(_ int, reply *int) error

func (*Player) RPCRemoveMusic

func (p *Player) RPCRemoveMusic(music shared.IntOrString, reply *int) error

func (*Player) RPCRemoveMusicFromPlayList

func (p *Player) RPCRemoveMusicFromPlayList(
	args shared.RemoveMusicFromPlayListArgs,
	reply *int,
) error

func (*Player) RPCRemovePlayList

func (p *Player) RPCRemovePlayList(name string, reply *int) error

func (*Player) RPCResume

func (p *Player) RPCResume(_ int, reply *int) error

func (*Player) RPCSeek

func (p *Player) RPCSeek(d time.Duration, _ *int) error

func (*Player) RPCSetTheme

func (p *Player) RPCSetTheme(theme string, reply *int) error

func (*Player) RPCStop

func (p *Player) RPCStop(_ int, reply *int) error

func (*Player) RPCVolume

func (p *Player) RPCVolume(vp uint8, reply *int) error

func (*Player) Remove

func (p *Player) Remove(music shared.IntOrString) error

func (*Player) RemoveMusicFromPlayList

func (p *Player) RemoveMusicFromPlayList(plname string, music shared.IntOrString) error

func (*Player) RemovePlayList

func (p *Player) RemovePlayList(plname string) error

func (*Player) Resume

func (p *Player) Resume() error

func (*Player) Seek

func (p *Player) Seek(d time.Duration) error

func (*Player) SetTheme

func (p *Player) SetTheme(theme string) error

func (*Player) Stop

func (p *Player) Stop() error

func (*Player) Update added in v0.0.33

func (p *Player) Update(_ int, reply *int) error

func (*Player) Volume

func (p *Player) Volume(
	vp uint8,
) error

type Release added in v0.0.33

type Release struct {
	Version string `json:"tag_name"`
}

type Updater added in v0.0.33

type Updater struct {
	IsUpdateAvailable  bool
	RemoteVersion      string
	EnableUpdatePrompt bool
}

func NewUpdater added in v0.0.33

func NewUpdater() *Updater

func (*Updater) CheckUpdate added in v0.0.33

func (u *Updater) CheckUpdate()

func (*Updater) GetRemoteVersion added in v0.0.33

func (u *Updater) GetRemoteVersion() (string, error)

func (*Updater) NeedsUpdate added in v0.0.33

func (u *Updater) NeedsUpdate(currentVersion string) (bool, string)

func (*Updater) Update added in v0.0.33

func (u *Updater) Update()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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