Documentation
¶
Index ¶
- Constants
- Variables
- func IsLoginByProvider(provider string) (bool, error)
- func ListAvailableProviders() []string
- func LoginByProvider(provider, username, password string) error
- func LogoutByProvider(provider string) error
- func RefreshLoginByProvider(provider string) error
- func RegisterProvider(provider MediaProvider)
- func RestoreSessionByProvider(provider, session string) error
- func SaveSessionByProvider(provider string) (string, error)
- func UnregisterAllProvider()
- func UnregisterProvider(name string)
- type Loginable
- type LyricContext
- type LyricLine
- type Lyrics
- type MediaInfo
- type MediaProvider
- type MediaUrl
- type MetaData
- type Picture
- type Playlist
- type QrLoginResult
- type QrLoginSession
- type Quality
Constants ¶
View Source
const VERSION = "0.2.6"
Variables ¶
View Source
var ( ErrorExternalApi = errors.New("miaosic: external api error") ErrorNoSuchProvider = errors.New("miaosic: no such provider") ErrorProviderNotLoginable = errors.New("miaosic: provider not loginable") ErrorDifferentProvider = errors.New("miaosic: different provider") ErrorInvalidPageSetting = errors.New("miaosic: invalid page setting") ErrorInvalidMediaMeta = errors.New("miaosic: invalid media meta") )
View Source
var ErrNotImplemented = errors.New("miaosic: not implemented")
View Source
var Requester dphttp.IRequester = deepcolor.NewRestyRequester()
Functions ¶
func IsLoginByProvider ¶ added in v0.2.6
func ListAvailableProviders ¶
func ListAvailableProviders() []string
func LoginByProvider ¶ added in v0.2.6
func LogoutByProvider ¶ added in v0.2.6
func RefreshLoginByProvider ¶ added in v0.2.6
func RegisterProvider ¶
func RegisterProvider(provider MediaProvider)
func RestoreSessionByProvider ¶ added in v0.2.6
func SaveSessionByProvider ¶ added in v0.2.6
func UnregisterAllProvider ¶ added in v0.2.5
func UnregisterAllProvider()
func UnregisterProvider ¶ added in v0.2.5
func UnregisterProvider(name string)
Types ¶
type Loginable ¶
type Loginable interface {
Login(username string, password string) error
Logout() error
IsLogin() bool
RefreshLogin() error
QrLogin() (*QrLoginSession, error)
QrLoginVerify(qrlogin *QrLoginSession) (*QrLoginResult, error)
RestoreSession(session string) error
SaveSession() string
}
type LyricContext ¶ added in v0.1.6
type Lyrics ¶
type Lyrics struct {
// Lang will is ISO 639-3 string
Lang string `json:"lang"`
Content []LyricLine `json:"content"`
}
func GetMediaLyric ¶ added in v0.1.6
func ParseLyrics ¶
func (*Lyrics) FindContext ¶ added in v0.1.6
func (l *Lyrics) FindContext(time float64, prev int, next int) *LyricContext
type MediaInfo ¶
type MediaInfo struct {
Title string `json:"title"`
Artist string `json:"artist"`
Cover Picture `json:"cover"`
Album string `json:"album"`
Meta MetaData `json:"meta"`
}
func GetMediaInfo ¶ added in v0.1.6
type MediaProvider ¶
type MediaProvider interface {
// GetName returns the name of the provider.
GetName() string
Qualities() []Quality
// Search returns a list of MetaData.
Search(keyword string, page, size int) ([]MediaInfo, error)
// MatchMedia returns a MetaData if the uri is matched, otherwise nil.
MatchMedia(uri string) (MetaData, bool)
GetMediaInfo(meta MetaData) (MediaInfo, error)
GetMediaUrl(meta MetaData, quality Quality) ([]MediaUrl, error)
GetMediaLyric(meta MetaData) ([]Lyrics, error)
// MatchPlaylist returns a MetaData if the uri is matched, otherwise nil.
MatchPlaylist(uri string) (MetaData, bool)
// GetPlaylist returns a Playlist, it fetches all data, so it might be slow.
GetPlaylist(meta MetaData) (*Playlist, error)
}
func GetProvider ¶
func GetProvider(name string) (MediaProvider, bool)
type MediaUrl ¶
type MediaUrl struct {
Url string `json:"url"`
Quality Quality `json:"quality"`
Header map[string]string `json:"header"`
}
func GetMediaUrl ¶ added in v0.1.6
func NewMediaUrl ¶
type MetaData ¶ added in v0.1.5
func MatchMedia ¶ added in v0.1.7
func MatchMediaByProvider ¶ added in v0.1.7
func MatchPlaylistByProvider ¶ added in v0.1.6
func NewMetaData ¶ added in v0.1.5
type Playlist ¶ added in v0.1.5
type Playlist struct {
Title string `json:"title"`
Medias []MediaInfo `json:"medias"`
Meta MetaData `json:"meta"`
}
func GetPlaylist ¶ added in v0.1.6
func (*Playlist) DisplayName ¶ added in v0.1.6
type QrLoginResult ¶ added in v0.1.5
func QrLoginVerifyByProvider ¶ added in v0.2.6
func QrLoginVerifyByProvider(provider string, qrlogin *QrLoginSession) (*QrLoginResult, error)
type QrLoginSession ¶ added in v0.1.5
func QrLoginByProvider ¶ added in v0.2.6
func QrLoginByProvider(provider string) (*QrLoginSession, error)
Click to show internal directories.
Click to hide internal directories.