pkg

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpenURL

func OpenURL(url string) error

Types

type Client

type Client struct {
	HTTPClient *http.Client
	BaseURL    string
}

Client is a simple HTTP client.

func NewClient

func NewClient() *Client

NewClient returns a new Client.

func (*Client) Search

func (c *Client) Search(ctx context.Context, query string, filter SearchType) (*SearchResponse, error)

type Playlist

type Playlist struct {
	Title       string   `json:"title"`
	Description string   `json:"description"`
	Tracks      []*Track `json:"tracks"`
	// contains filtered or unexported fields
}

func LoadFromFile

func LoadFromFile(filename string) (*Playlist, error)

func (*Playlist) DeleteEntry

func (p *Playlist) DeleteEntry(index int)

func (*Playlist) InsertTrack

func (p *Playlist) InsertTrack(track *Track, index int)

func (*Playlist) MoveEntryDown

func (p *Playlist) MoveEntryDown(index int) int

func (*Playlist) MoveEntryUp

func (p *Playlist) MoveEntryUp(index int) int

MoveEntryUp moves an entry up in the playlist and returns the new index

func (*Playlist) Render

func (p *Playlist) Render() (string, error)

func (*Playlist) SaveToFile

func (p *Playlist) SaveToFile(filename string) error

func (*Playlist) ToJSON

func (p *Playlist) ToJSON() []byte

type Result

type Result struct {
	AlbumID     int64  `json:"album_id"`
	AlbumName   string `json:"album_name"`
	ArtID       int64  `json:"art_id"`
	BandID      int64  `json:"band_id"`
	BandName    string `json:"band_name"`
	ID          int64  `json:"id"`
	Img         string `json:"img"`
	ImgID       int64  `json:"img_id"`
	ItemURLPath string `json:"item_url_path"`
	ItemURLRoot string `json:"item_url_root"`
	Name        string `json:"name"`
	StatParams  string `json:"stat_params"`
	Type        string `json:"type"`
}

type SearchRequest

type SearchRequest struct {
	FanID        *int       `json:"fan_id"`
	FullPage     bool       `json:"full_page"`
	SearchFilter SearchType `json:"search_filter"`
	SearchText   string     `json:"search_text"`
}

type SearchResponse

type SearchResponse struct {
	Auto struct {
		Results      []*Result `json:"results"`
		StatParams   string    `json:"stat_params_for_tag"`
		ResponseTime int       `json:"time_ms"`
	} `json:"auto"`
	Genre struct{} `json:"genre"`
	Tag   struct {
		Count        int `json:"count"`
		Matches      []struct{}
		ResponseTime int `json:"time_ms"`
	} `json:"tag"`
}

type SearchType

type SearchType string
const (
	FilterAlbum SearchType = "a"
	FilterBand  SearchType = "b"
	FilterTrack SearchType = "t"
	FilterAll   SearchType = ""
)

type Track

type Track struct {
	BackgroundColor string `json:"background_color"`
	LinkColor       string `json:"link_color"`
	AlbumID         int64  `json:"album_id"`
	Name            string `json:"name"`
	BandName        string `json:"band_name"`
	ItemURLPath     string `json:"item_url_path"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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