feat: docs for functions
This commit is contained in:
parent
0c9fc960ff
commit
da31a12acb
|
@ -111,6 +111,7 @@ func (ncm *NeteaseCloudMusic) mimeType() string {
|
||||||
return "image/jpeg"
|
return "image/jpeg"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Dump encrypted ncm file to normal music file. If `targetDir` is "", the converted file will be saved to the original directory.
|
||||||
func (ncm *NeteaseCloudMusic) Dump(targetDir string) (bool, error) {
|
func (ncm *NeteaseCloudMusic) Dump(targetDir string) (bool, error) {
|
||||||
ncm.mDumpFilePath = ncm.mFilePath
|
ncm.mDumpFilePath = ncm.mFilePath
|
||||||
var outputStream *os.File
|
var outputStream *os.File
|
||||||
|
@ -157,6 +158,8 @@ func (ncm *NeteaseCloudMusic) Dump(targetDir string) (bool, error) {
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FixMetadata will fix the missing metadata for target music file, the source of the metadata comes from origin ncm file.
|
||||||
|
// Since NeteaseCloudMusic version 3.0, the album cover image is no longer embedded in the ncm file. If the parameter is true, it means downloading the image from the NetEase server and embedding it into the target music file (network connection required)
|
||||||
func (ncm *NeteaseCloudMusic) FixMetadata(fetchAlbumImageFromRemote bool) (bool, error) {
|
func (ncm *NeteaseCloudMusic) FixMetadata(fetchAlbumImageFromRemote bool) (bool, error) {
|
||||||
if fetchAlbumImageFromRemote {
|
if fetchAlbumImageFromRemote {
|
||||||
// get the album pic from url
|
// get the album pic from url
|
||||||
|
@ -226,10 +229,16 @@ func (ncm *NeteaseCloudMusic) FixMetadata(fetchAlbumImageFromRemote bool) (bool,
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetDumpFilePath returns the absolute path of dumped music file
|
||||||
func (ncm *NeteaseCloudMusic) GetDumpFilePath() string {
|
func (ncm *NeteaseCloudMusic) GetDumpFilePath() string {
|
||||||
|
path, err := filepath.Abs(ncm.mDumpFilePath)
|
||||||
|
if err != nil {
|
||||||
return ncm.mDumpFilePath
|
return ncm.mDumpFilePath
|
||||||
|
}
|
||||||
|
return path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewNeteaseCloudMusic returns a new NeteaseCloudMusic instance, if the format of the file is incorrect, the error will be returned.
|
||||||
func NewNeteaseCloudMusic(filePath string) (*NeteaseCloudMusic, error) {
|
func NewNeteaseCloudMusic(filePath string) (*NeteaseCloudMusic, error) {
|
||||||
ncm := &NeteaseCloudMusic{
|
ncm := &NeteaseCloudMusic{
|
||||||
sCoreKey: [17]byte{0x68, 0x7A, 0x48, 0x52, 0x41, 0x6D, 0x73, 0x6F, 0x35, 0x6B, 0x49, 0x6E, 0x62, 0x61, 0x78, 0x57, 0},
|
sCoreKey: [17]byte{0x68, 0x7A, 0x48, 0x52, 0x41, 0x6D, 0x73, 0x6F, 0x35, 0x6B, 0x49, 0x6E, 0x62, 0x61, 0x78, 0x57, 0},
|
||||||
|
|
Loading…
Reference in New Issue