types

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package types provides the data structures for Gophercast.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Path

type Path string

Path represents a file path.

func NewPath

func NewPath(s string) (Path, error)

func NewPathInFS

func NewPathInFS(fsys fs.FS, relativePath string, root Path) (Path, error)

func (Path) Exists

func (p Path) Exists() bool

func (Path) IsDir

func (p Path) IsDir() bool

func (Path) String

func (p Path) String() string

type Playlist

type Playlist []Track

Playlist is a collection of tracks.

func (*Playlist) Current

func (p *Playlist) Current() *Track

func (*Playlist) Len

func (p *Playlist) Len() int

func (*Playlist) MarkIsPlaying

func (p *Playlist) MarkIsPlaying(idx int)

func (*Playlist) Next

func (p *Playlist) Next() *Track

func (*Playlist) Previous

func (p *Playlist) Previous() *Track

type Source

type Source string

Source represents the source of a track.

const (
	SourceLocalDir        Source = "dir-to-mp3"
	SourceLocalFile       Source = "local-file"
	SourceYoutube         Source = "youtube"
	SourceYoutubePlaylist Source = "yt-playlist"
)

func (Source) IsValid

func (s Source) IsValid() bool

func (Source) String

func (s Source) String() string

type Track

type Track struct {
	Title     string
	Path      Path
	Duration  time.Duration
	Source    Source
	IsPlaying bool
}

Track represents a single audio track.

func (Track) Validate

func (t Track) Validate() error

Jump to

Keyboard shortcuts

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