mpdclient

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2025 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DirectoryType fileType = iota
	FileType
	PlaylistType
)

Variables

This section is empty.

Functions

func GetUpdateMsg

func GetUpdateMsg(subsystem string) tea.Msg

func HumanizeTime

func HumanizeTime(s int) string

Types

type File

type File struct {
	FileType     fileType
	Path         string
	LastModified time.Time

	Title    string
	Artist   string
	Duration int

	Album       string
	AlbumArtist string
	TrackNr     int

	IsMarked bool
	// contains filtered or unexported fields
}

func FileFromAttrs

func FileFromAttrs(info mpd.Attrs) File

func FilesFromAttrs

func FilesFromAttrs(infos []mpd.Attrs) []File

func PlaylistFileFromAttrs

func PlaylistFileFromAttrs(info mpd.Attrs) File

func PlaylistFilesFromAttrs

func PlaylistFilesFromAttrs(infos []mpd.Attrs) []File

func (File) GetLastModified added in v0.0.9

func (t File) GetLastModified() time.Time

func (File) GetPath added in v0.0.9

func (t File) GetPath() string

func (File) Group

func (t File) Group() string

func (File) Id

func (t File) Id() int

func (File) Length

func (t File) Length() int

func (File) Text

func (t File) Text() string

func (File) TextRight added in v0.0.9

func (t File) TextRight() string

type MpdClient

type MpdClient struct {
	*mpd.Client
	*mpd.Watcher
}

func GetClient

func GetClient(mpdHost string, mpdPort string, mpdPassword string) *MpdClient

func (*MpdClient) Close

func (mpd *MpdClient) Close()

func (*MpdClient) CurrentSong

func (mpd *MpdClient) CurrentSong() Track

func (*MpdClient) GetLibraryPath

func (mpd *MpdClient) GetLibraryPath(path string) (int, []File)

func (*MpdClient) GetPlaylist

func (mpd *MpdClient) GetPlaylist(path string) []File

func (*MpdClient) GetPlaylists

func (mpd *MpdClient) GetPlaylists() []File

func (*MpdClient) GetQueue

func (mpd *MpdClient) GetQueue() []Track

func (*MpdClient) PlaylistAdd

func (mpd *MpdClient) PlaylistAdd(name, uri string) error

func (*MpdClient) PlaylistDelete

func (mpd *MpdClient) PlaylistDelete(name string, pos int)

func (*MpdClient) PlaylistMove

func (mpd *MpdClient) PlaylistMove(name string, from int, to int)

func (*MpdClient) PlaylistRemove

func (mpd *MpdClient) PlaylistRemove(name string)

func (*MpdClient) PlaylistSave

func (mpd *MpdClient) PlaylistSave(name string) error

func (*MpdClient) Search added in v0.0.9

func (mpd *MpdClient) Search(term string) ([]Track, error)

* search the db

func (*MpdClient) Seek added in v0.0.5

func (mpd *MpdClient) Seek(pos, sec int)

* seek song in pos to sec

func (*MpdClient) Status

func (mpd *MpdClient) Status() MpdStatus

func (*MpdClient) UpdateLibrary

func (mpd *MpdClient) UpdateLibrary()

type MpdStatus

type MpdStatus struct {
	PlaylistLength int
	Song           int //song: playlist song number of the current song stopped on or playing
	Elapsed        int
	State          State
	Volume         int
}

type State

type State int
const (
	PlayingState State = iota
	PausedState
	StoppedState
)

func (State) GetStateSymbol

func (s State) GetStateSymbol() string

type SubsystemEventMsg

type SubsystemEventMsg string

type Track

type Track struct {
	Title        string
	Artist       string
	AlbumArtist  string
	Duration     int
	LastModified time.Time

	Album   string
	Year    string
	TrackNr int

	Path string

	Pos int
	// contains filtered or unexported fields
}

func TrackFromAttrs

func TrackFromAttrs(info mpd.Attrs) Track

func TracksFromAttrs

func TracksFromAttrs(infos []mpd.Attrs) []Track

func (Track) GetLastModified added in v0.0.9

func (t Track) GetLastModified() time.Time

func (Track) GetPath added in v0.0.9

func (t Track) GetPath() string

func (Track) Group

func (t Track) Group() string

func (Track) Id

func (t Track) Id() int

func (Track) Length

func (t Track) Length() int

func (Track) Text

func (t Track) Text() string

func (Track) TextRight added in v0.0.9

func (t Track) TextRight() string

Jump to

Keyboard shortcuts

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