music

package
v0.0.0-...-4aa44aa Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrForbidden = errors.New("forbidden")
View Source
var ErrNotFound = errors.New("not found")

Functions

This section is empty.

Types

type Access

type Access struct {
	Public bool `json:"public"`
}

type Album

type Album struct {
	Id        AlbumId    `json:"id,omitempty"`
	Title     string     `json:"title,omitempty"`
	Thumbnail *Thumbnail `json:"thumbnail,omitempty"`
	Access    Access     `json:"access,omitempty"`

	// Parents list the parents of this album starting from the one
	// furthest away from this album. The list of parent albums includes
	// this particular album. Only fields Id and Title are filled in.
	Parents []Album `json:"parents,omitempty"`
	Albums  []Album `json:"albums,omitempty"`
	Tracks  []Track `json:"tracks,omitempty"`
}

type AlbumId

type AlbumId string

func (AlbumId) String

func (id AlbumId) String() string

type BasicAlbum

type BasicAlbum struct {
	Path      []AlbumId
	Title     string
	Thumbnail *Thumbnail
}

type Browse

type Browse struct {
	Ids        []AlbumId
	PublicOnly bool
}

type BrowseHandler

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

func NewBrowseHandler

func NewBrowseHandler(library Library) *BrowseHandler

func (*BrowseHandler) Execute

func (h *BrowseHandler) Execute(cmd Browse) (Album, error)

type ConvertedFile

type ConvertedFile struct {
	// Name is just a filename used for mimetype detection. It is here just to
	// check its extension type basically.
	Name string

	// Modtime is used to figure out if the content has changed.
	Modtime time.Time

	// Content must be closed by the caller.
	Content io.ReadSeekCloser
}

type FileId

type FileId string

func (FileId) String

func (id FileId) String() string

type Library

type Library interface {
	Browse(ids []AlbumId, publicOnly bool) (Album, error)
	Search(query string, publicOnly bool) (SearchResult, error)
}

type Query

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

func MustNewQuery

func MustNewQuery(s string) Query

func NewQuery

func NewQuery(s string) (Query, error)

func (Query) IsZero

func (q Query) IsZero() bool

func (Query) String

func (q Query) String() string
type Search struct {
	Query      Query
	PublicOnly bool
}

type SearchHandler

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

func NewSearchHandler

func NewSearchHandler(library Library) *SearchHandler

func (*SearchHandler) Execute

func (h *SearchHandler) Execute(cmd Search) (SearchResult, error)

type SearchResult

type SearchResult struct {
	Albums []BasicAlbum
	Tracks []SearchResultTrack
}

type SearchResultTrack

type SearchResultTrack struct {
	Track Track
	Album BasicAlbum
}

type Thumbnail

type Thumbnail struct {
	FileId FileId `json:"fileId,omitempty"`
}

type ThumbnailHandler

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

func NewThumbnailHandler

func NewThumbnailHandler(thumbnailStore ThumbnailStore) *ThumbnailHandler

func (*ThumbnailHandler) Execute

func (h *ThumbnailHandler) Execute(ctx context.Context, id string) (ConvertedFile, error)

type ThumbnailStore

type ThumbnailStore interface {
	GetConvertedFile(ctx context.Context, id string) (ConvertedFile, error)
}

type Track

type Track struct {
	Id       TrackId `json:"id,omitempty"`
	FileId   FileId  `json:"fileId,omitempty"`
	Title    string  `json:"title,omitempty"`
	Duration float64 `json:"duration,omitempty"`
}

type TrackHandler

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

func NewTrackHandler

func NewTrackHandler(trackStore TrackStore) *TrackHandler

func (*TrackHandler) Execute

func (h *TrackHandler) Execute(ctx context.Context, id string) (ConvertedFile, error)

type TrackId

type TrackId string

func (TrackId) String

func (id TrackId) String() string

type TrackStore

type TrackStore interface {
	GetConvertedFile(ctx context.Context, id string) (ConvertedFile, error)
}

Jump to

Keyboard shortcuts

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