Documentation ¶
Index ¶
- Constants
- Variables
- func AlbumDetail(albumID int, reqData *utils.RequestData) (result types.Slice[*SingleInfo], err error)
- func AlbumLinkID(s string) (int, error)
- func AsyncDownload(songs types.Slice[*SingleInfo], destDir string) error
- func DownloadFile(url string, single *SingleInfo, destDir string) error
- func DownloadLink(songIDs []int, reqData *utils.RequestData) (result types.Slice[*DownloadInfo], err error)
- func IsAlbumLink(s string) bool
- func IsPlaylistLink(s string) bool
- func IsSingleLink(s string) bool
- func MergeURL(downloadInfo types.Slice[*DownloadInfo], detail *types.Slice[*SingleInfo])
- func Path(destDir string) string
- func PlaylistDetail(playlistID int, reqData *utils.RequestData) (result types.Slice[*SingleInfo], err error)
- func PlaylistLinkID(s string) (int, error)
- func SingleDetail(singleID int, reqData *utils.RequestData) (result types.Slice[*SingleInfo], err error)
- func SingleLinkID(s string) (int, error)
- func WriteTag(filePath string, single *SingleInfo) error
- type AlbumInfo
- type AlbumResult
- type ArtistInfo
- type CookieFile
- type DownloadInfo
- type DownloadResult
- type Link
- type LinkOption
- type LinkType
- type PlaylistInfo
- type PlaylistResult
- type SingleInfo
- type SingleResult
Constants ¶
View Source
const ( PoolSize = 5 NullSeparator = "\u0000" )
View Source
const ( ErrSongDetailIsEmpty types.Error = "单曲详情为空" ErrSongDownload types.Error = "解析歌单歌曲下载链接异常" )
View Source
const ( ErrAlbumIsEmpty types.Error = "专辑歌曲为空" ErrAlbumDownload types.Error = "解析专辑歌曲下载链接异常" )
View Source
const ( ErrPlaylistIsEmpty types.Error = "歌单列表为空" ErrPlaylistDownload types.Error = "解析歌单歌曲下载链接异常" )
View Source
const ( ErrCannotFindSingleID types.Error = "没有匹配到单曲ID" ErrCannotFindAlbumID types.Error = "没有匹配到专辑ID" ErrCannotFindPlaylistID types.Error = "没有匹配到歌单ID" )
View Source
const ( ErrLinkTypeNotMatch types.Error = "链接不是歌单、专辑、单曲类型" ErrLinkIDNotMatch types.Error = "链接无法匹配ID" )
View Source
const (
ErrCookieFile types.Error = "cookies文件格式异常"
)
View Source
const (
ErrInputLinksAreEmpty types.Error = "请输入歌单、专辑、单曲链接"
)
Variables ¶
View Source
var AppLogger *logrus.Logger
View Source
var DefaultPoolSize = PoolSize
Functions ¶
func AlbumDetail ¶
func AlbumDetail(albumID int, reqData *utils.RequestData) (result types.Slice[*SingleInfo], err error)
func AlbumLinkID ¶
func AsyncDownload ¶
func AsyncDownload(songs types.Slice[*SingleInfo], destDir string) error
func DownloadFile ¶
func DownloadFile(url string, single *SingleInfo, destDir string) error
func DownloadLink ¶
func DownloadLink(songIDs []int, reqData *utils.RequestData) (result types.Slice[*DownloadInfo], err error)
func IsAlbumLink ¶
func IsPlaylistLink ¶
func IsSingleLink ¶
func MergeURL ¶
func MergeURL(downloadInfo types.Slice[*DownloadInfo], detail *types.Slice[*SingleInfo])
func PlaylistDetail ¶
func PlaylistDetail(playlistID int, reqData *utils.RequestData) (result types.Slice[*SingleInfo], err error)
func PlaylistLinkID ¶
func SingleDetail ¶
func SingleDetail(singleID int, reqData *utils.RequestData) (result types.Slice[*SingleInfo], err error)
func SingleLinkID ¶
func WriteTag ¶
func WriteTag(filePath string, single *SingleInfo) error
Types ¶
type AlbumInfo ¶
type AlbumResult ¶
type AlbumResult struct { Songs types.Slice[*SingleInfo] `json:"songs"` Album *AlbumInfo `json:"album"` }
func (*AlbumResult) String ¶
func (a *AlbumResult) String() string
type ArtistInfo ¶
func (*ArtistInfo) String ¶
func (a *ArtistInfo) String() string
type CookieFile ¶
func NewCookieFile ¶
func NewCookieFile(cookieFile string) *CookieFile
func (*CookieFile) IsEmpty ¶
func (c *CookieFile) IsEmpty() bool
func (*CookieFile) String ¶
func (c *CookieFile) String() string
func (*CookieFile) ToHttpCookie ¶
func (c *CookieFile) ToHttpCookie() (cookie types.Slice[*http.Cookie])
type DownloadInfo ¶
func (*DownloadInfo) String ¶
func (d *DownloadInfo) String() string
type DownloadResult ¶
type DownloadResult struct {
Data types.Slice[*DownloadInfo] `json:"data"`
}
func (*DownloadResult) String ¶
func (d *DownloadResult) String() string
type Link ¶
type LinkOption ¶
type LinkOption func(link *Link)
func LinkOptionCookieFile ¶
func LinkOptionCookieFile(file *CookieFile) LinkOption
func LinkOptionOnlyInfo ¶
func LinkOptionOnlyInfo(flag bool) LinkOption
func LinkOptionTmp ¶
func LinkOptionTmp(flag bool) LinkOption
type PlaylistInfo ¶
type PlaylistInfo struct {
Tracks types.Slice[*SingleInfo] `json:"tracks"`
}
func (*PlaylistInfo) String ¶
func (p *PlaylistInfo) String() string
type PlaylistResult ¶
type PlaylistResult struct {
Playlist *PlaylistInfo `json:"playlist"`
}
func (*PlaylistResult) String ¶
func (p *PlaylistResult) String() string
type SingleInfo ¶
type SingleInfo struct { ID int `json:"id"` Name string `json:"name"` Artist types.Slice[*ArtistInfo] `json:"ar"` Album *AlbumInfo `json:"al"` URL string `json:"url"` }
func (*SingleInfo) AllArtistsTag ¶
func (s *SingleInfo) AllArtistsTag() string
func (*SingleInfo) CoverURL ¶
func (s *SingleInfo) CoverURL() string
func (*SingleInfo) FileName ¶
func (s *SingleInfo) FileName() string
func (*SingleInfo) SaveFileName ¶
func (s *SingleInfo) SaveFileName() string
func (*SingleInfo) SavePath ¶
func (s *SingleInfo) SavePath() string
func (*SingleInfo) String ¶
func (s *SingleInfo) String() string
type SingleResult ¶
type SingleResult struct {
Songs types.Slice[*SingleInfo] `json:"songs"`
}
func (*SingleResult) String ¶
func (s *SingleResult) String() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.