platform

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fetcher

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

func NewFetcher

func NewFetcher(ytf *Youtube, spf *Spotify) *Fetcher

func (*Fetcher) Fetch

func (f *Fetcher) Fetch(query string) (Streamer, error)

func (*Fetcher) Search

func (f *Fetcher) Search(query string) ([]player.TrackData, error)

type Platform

type Platform interface {
	SearchString(s string) (*player.TrackData, error)
	SearchUrl(url string) ([]player.TrackData, error)
	Fetch(url string) (Streamer, error)
}

type Spotify added in v0.1.0

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

func NewSpotify added in v0.1.0

func NewSpotify(clientId, clientSecret string, yt *Youtube) (*Spotify, error)

func (*Spotify) Fetch added in v0.1.0

func (s *Spotify) Fetch(query string) (Streamer, error)

Fetch implements Platform.

func (*Spotify) SearchString added in v0.1.0

func (s *Spotify) SearchString(query string) (*player.TrackData, error)

SearchString implements Platform.

func (*Spotify) SearchUrl added in v0.1.0

func (s *Spotify) SearchUrl(uri string) ([]player.TrackData, error)

SearchUrl implements Platform.

type Streamer

type Streamer interface {
	ReadOpus() ([]byte, error)
	SetSpeed(speed TrackSpeed) error
	SetVolume(volume uint8) error

	io.Closer
}

type TrackSpeed

type TrackSpeed int8
const (
	TrackSpeed_0_25X TrackSpeed = iota - 3
	TrackSpeed_0_5X
	TrackSpeed_0_75X
	// Default speed
	TrackSpeed_1X
	TrackSpeed_1_25X
	TrackSpeed_1_5X
	TrackSpeed_1_75X
	TrackSpeed_2X
)

type Youtube

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

func NewYoutube

func NewYoutube(client *http.Client, maxDlRoutines int) *Youtube

if client == nil, it will be defaulted to http.DefaultClient

func (*Youtube) Fetch

func (y *Youtube) Fetch(id string) (Streamer, error)

Fetch implements Platform.

func (*Youtube) SearchString

func (y *Youtube) SearchString(s string) (*player.TrackData, error)

SearchString implements Platform. The youtube search is extremely unstable and may break on any youtube update.

The data is extracted from html youtube responses.

func (*Youtube) SearchUrl

func (y *Youtube) SearchUrl(url string) ([]player.TrackData, error)

SearchUrl implements Platform.

Jump to

Keyboard shortcuts

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