di

package
v0.12.8 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: GPL-3.0 Imports: 14 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeRatelimit

func MakeRatelimit(amount int, interval time.Duration) <-chan struct{}

MakeRateLimit creates and starts a ratelimiter that can be used in Config.

Types

type Backend

type Backend interface {
	Init() error

	player.Backend
}

type BackendBuilder

type BackendBuilder struct {
	Name  string
	Build func(di *DI, log *log.Logger) (Backend, error)
}

type Config

type Config struct {
	// Defaults to an stderr logger
	Log *log.Logger

	// Defaults to 8
	ConcurrentDownloads int

	// Defaults to ~/.cache/ym
	StorePath string

	// Default to ~/.cache/ym/mpv-ipc.sock if not compiled with libmpv
	SocketPath string

	// Extra mpv flags when using RPC
	MPVFlags []string

	// Defaults to os.Stderr
	BackendLogger io.Writer

	AutoSave bool

	// Mutually exclusive with CustomOutput.
	SimpleOutput io.Writer

	// Mutually exclusive with SimpleOutput.
	CustomOutput ui.Output

	CustomError ui.ErrorReporter

	// Ratelimit ratelimits youtube.com calls by pulling items for the given
	// channels before each action.
	// If nil, a default ratelimiter of 1 item every 5 seconds is used for each.
	RatelimitDownloads <-chan struct{}
	RatelimitMeta      <-chan struct{}

	// AcoustID config
	AcoustID acoustid.Config
}

type DI

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

func New

func New(c Config) *DI

func (*DI) AcoustID added in v0.9.5

func (di *DI) AcoustID() *acoustid.Client

func (*DI) Backend

func (di *DI) Backend() Backend

func (*DI) BackendAvailable

func (di *DI) BackendAvailable() (string, error)

func (*DI) BaseUI

func (di *DI) BaseUI() ui.UI

func (*DI) Collection

func (di *DI) Collection() *collection.Collection

func (*DI) CommandParser

func (di *DI) CommandParser() *ui.CommandParser

func (*DI) Log

func (di *DI) Log() *log.Logger

func (*DI) MPVFlags added in v0.10.0

func (di *DI) MPVFlags() []string

func (*DI) Player

func (di *DI) Player() *player.Player

func (*DI) Queue

func (di *DI) Queue() *collection.Queue

func (*DI) Rates

func (di *DI) Rates() (<-chan struct{}, <-chan struct{})

func (*DI) Store

func (di *DI) Store() string

Jump to

Keyboard shortcuts

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