files

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMissingArtist = errors.New("missing artist")
View Source
var ErrMissingAudio = errors.New("no audio stream")
View Source
var ErrNoFilesFound = errors.New("no files found")

Functions

func GetCandidates

func GetCandidates(source string, exts []string, opts ...FileOptions) []string

func GetTmpFilename

func GetTmpFilename(source string) (string, error)

func MoveToMusicFolder added in v0.3.0

func MoveToMusicFolder(ctx context.Context, source, dest string, exts []string, overrides map[string]string, recurse bool) error

func PickRandomFile

func PickRandomFile(source string, exts []string, opts ...FileOptions) (path string, total int, err error)

PickRandomFile returns a random file from source which has an extension matching one of exts. It returns the random file, and the total number of files. If no files are found the error will be ErrNoFilesFound.

Types

type FileOptions added in v0.4.2

type FileOptions func(*fileOpts)
var (
	WithoutRecursion FileOptions = func(fo *fileOpts) { fo.recurse = false }
	MostRecent       FileOptions = func(fo *fileOpts) { fo.sort = sortRecent }
	Oldest           FileOptions = func(fo *fileOpts) { fo.sort = sortOldest }
)

func ChooseFrom added in v0.4.2

func ChooseFrom(num int) FileOptions

Jump to

Keyboard shortcuts

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