ncm

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeCover

func DecodeCover(rs io.ReadSeeker, w io.Writer) error

DecodeCover decode cover image

func DecodeKey

func DecodeKey(rs io.ReadSeeker) ([]byte, error)

DecodeKey decode key

func DecodeMusic

func DecodeMusic(rs io.ReadSeeker, w io.Writer) error

func IsNCMFile

func IsNCMFile(rs io.ReadSeeker) error

IsNCMFile check whether the file is ncm file

Types

type AlbumPicDocId

type AlbumPicDocId string

AlbumPicDocId 解决有的歌曲id为int有的歌曲id为string问题

func (*AlbumPicDocId) UnmarshalJSON

func (a *AlbumPicDocId) UnmarshalJSON(data []byte) error

type Artist

type Artist struct {
	Name string
	Id   int64
}

func (*Artist) UnmarshalJSON

func (a *Artist) UnmarshalJSON(data []byte) error

type CoverType

type CoverType string
const (
	CoverTypeUnknown CoverType = "unknown"
	CoverTypePng     CoverType = "png"
	CoverTypeJpeg    CoverType = "jpeg"
)

func DecodeCoverType

func DecodeCoverType(rs io.ReadSeeker) (CoverType, error)

func DetectCoverType

func DetectCoverType(data []byte) CoverType

func (CoverType) FileType

func (c CoverType) FileType() string

func (CoverType) MIME

func (c CoverType) MIME() string

type File

type File struct {
	*NCM
	// contains filtered or unexported fields
}

func Open

func Open(filename string) (*File, error)

func (*File) Close

func (f *File) Close() error

type Metadata

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

func DecodeMeta

func DecodeMeta(rs io.ReadSeeker) (*Metadata, error)

DecodeMeta decode meta info

func (*Metadata) GetDJ

func (m *Metadata) GetDJ() *MetadataDJ

func (*Metadata) GetMusic

func (m *Metadata) GetMusic() *MetadataMusic

func (*Metadata) GetType

func (m *Metadata) GetType() MetadataType

type MetadataDJ

type MetadataDJ struct {
	ProgramID          int64         `json:"programId"`
	ProgramName        string        `json:"programName"`
	MainMusic          MetadataMusic `json:"mainMusic"`
	DjID               int64         `json:"djId"`
	DjName             string        `json:"djName"`
	DjAvatarURL        string        `json:"djAvatarUrl"`
	CreateTime         int64         `json:"createTime"`
	Brand              string        `json:"brand"`
	Serial             int64         `json:"serial"`
	ProgramDesc        string        `json:"programDesc"`
	ProgramFeeType     int64         `json:"programFeeType"`
	ProgramBuyed       bool          `json:"programBuyed"`
	RadioID            int64         `json:"radioId"`
	RadioName          string        `json:"radioName"`
	RadioCategory      string        `json:"radioCategory"`
	RadioCategoryID    int64         `json:"radioCategoryId"`
	RadioDesc          string        `json:"radioDesc"`
	RadioFeeType       int64         `json:"radioFeeType"`
	RadioFeeScope      int64         `json:"radioFeeScope"`
	RadioBuyed         bool          `json:"radioBuyed"`
	RadioPrice         int64         `json:"radioPrice"`
	RadioPurchaseCount int64         `json:"radioPurchaseCount"`
}

type MetadataMusic

type MetadataMusic struct {
	Id            int64         `json:"musicId"`
	Name          string        `json:"musicName"`
	Artists       []Artist      `json:"artist"`
	AlbumId       int64         `json:"albumId"`
	Album         string        `json:"album"`
	AlbumPic      string        `json:"albumPic"`      // eg: https://p4.music.126.net/cg5ZWookeo8bBHlwp906_Q==/109951165709257937.jpg
	AlbumPicDocId AlbumPicDocId `json:"albumPicDocId"` // eg: 109951165709257937
	BitRate       int64         `json:"bitrate"`       //
	Mp3DocId      string        `json:"mp3DocId"`      // eg: 7caa09bd32c62d0f415e45c0eec3da43
	MvId          int64         `json:"mvId"`
	Alias         []interface{} `json:"alias"`
	TransNames    []interface{} `json:"transNames"`
	Duration      int64         `json:"duration"` // 单位毫秒
	Format        string        `json:"format"`   // eg: flac

	Comment string `json:"-"` // 为了方便放到此处,此字段不属于ncm内容
}

MetadataMusic .

type MetadataType

type MetadataType string
const (
	MetadataTypeMusic MetadataType = "music"
	MetadataTypeDJ    MetadataType = "dj"
)

type NCM

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

func FromReadSeeker

func FromReadSeeker(rs io.ReadSeeker) (*NCM, error)

func (*NCM) DecodeCover

func (n *NCM) DecodeCover(w io.Writer) error

func (*NCM) DecodeCoverType

func (n *NCM) DecodeCoverType() (CoverType, error)

func (*NCM) DecodeMusic

func (n *NCM) DecodeMusic(w io.Writer) error

func (*NCM) Metadata

func (n *NCM) Metadata() *Metadata

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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