Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a62f5156f0 | |||
| 747343162b | |||
| 676641d5f9 | |||
| 96dc36f112 | |||
|
54da5b7a35
|
|||
|
4d0622073a
|
|||
| 49e554931e |
@@ -2,7 +2,13 @@
|
|||||||
|
|
||||||
基于 https://github.com/taurusxin/ncmdump 的 Golang 移植版
|
基于 https://github.com/taurusxin/ncmdump 的 Golang 移植版
|
||||||
|
|
||||||
支持网易云音乐最新的 3.x 版本,但需要注意:从该版本开始网易云音乐不再在 ncm 文件中内置封面图片,本工具支持从网易服务器上自动下载对应歌曲的封面图并写入到最终的音乐文件中
|
支持网易云音乐最新的 3.x 版本,但需要注意:从 3. x开始的某些网易云音乐版本不再在 ncm 文件中内置封面图片,本项目支持从网易服务器上自动下载对应歌曲的封面图并写入到最终的音乐文件中
|
||||||
|
|
||||||
|
你也可以去 https://git.taurusxin.com/taurusxin/ncmdump-gui 下载基于本项目的 gui 可视化图形应用,只需简单点击即可自动转换。
|
||||||
|
|
||||||
|
## 如何提 Issue
|
||||||
|
|
||||||
|
由于本站恶意机器人注册过多,已关闭账号注册,如果需要提 Issue 请前往 [GitHub](https://github.com/taurusxin/ncmdump),必须注明 Issue 的主题为 ncmdump-go,敬请谅解。
|
||||||
|
|
||||||
## 安装
|
## 安装
|
||||||
|
|
||||||
|
|||||||
2
build.sh
2
build.sh
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
VERSION=1.7.3
|
VERSION=1.7.5
|
||||||
|
|
||||||
# Clean up the build directory
|
# Clean up the build directory
|
||||||
rm -rf build
|
rm -rf build
|
||||||
|
|||||||
2
main.go
2
main.go
@@ -59,7 +59,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if *showVersion {
|
if *showVersion {
|
||||||
fmt.Println("ncmdump version 1.7.3")
|
fmt.Println("ncmdump version 1.7.5")
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ func NewNeteaseCloudMusicMetadata(meta string) *NeteaseClousMusicMetadata {
|
|||||||
if len(artists) > 0 {
|
if len(artists) > 0 {
|
||||||
for i, artist := range artists {
|
for i, artist := range artists {
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
metaData.mArtist += "/"
|
metaData.mArtist += " / "
|
||||||
}
|
}
|
||||||
metaData.mArtist += artist.Array()[0].String()
|
metaData.mArtist += artist.Array()[0].String()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,15 +5,16 @@ import (
|
|||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/bogem/id3v2/v2"
|
|
||||||
"github.com/go-flac/flacpicture"
|
|
||||||
"github.com/go-flac/flacvorbis"
|
|
||||||
"github.com/go-flac/go-flac"
|
|
||||||
"git.taurusxin.com/taurusxin/ncmdump-go/utils"
|
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
|
"git.taurusxin.com/taurusxin/ncmdump-go/utils"
|
||||||
|
"github.com/bogem/id3v2/v2"
|
||||||
|
"github.com/go-flac/flacpicture"
|
||||||
|
"github.com/go-flac/flacvorbis"
|
||||||
|
"github.com/go-flac/go-flac"
|
||||||
)
|
)
|
||||||
|
|
||||||
type NcmFormat = string
|
type NcmFormat = string
|
||||||
@@ -152,7 +153,7 @@ func (ncm *NeteaseCloudMusic) Dump(targetDir string) (bool, error) {
|
|||||||
outputStream = output
|
outputStream = output
|
||||||
}
|
}
|
||||||
|
|
||||||
outputStream.Write(buffer)
|
outputStream.Write(buffer[:n])
|
||||||
}
|
}
|
||||||
|
|
||||||
outputStream.Close()
|
outputStream.Close()
|
||||||
@@ -179,7 +180,8 @@ func (ncm *NeteaseCloudMusic) FixMetadata(fetchAlbumImageFromRemote bool) (bool,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ncm.mFormat == Mp3 {
|
switch ncm.mFormat {
|
||||||
|
case Mp3:
|
||||||
audioFile, err := id3v2.Open(ncm.mDumpFilePath, id3v2.Options{Parse: true})
|
audioFile, err := id3v2.Open(ncm.mDumpFilePath, id3v2.Options{Parse: true})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
@@ -205,7 +207,7 @@ func (ncm *NeteaseCloudMusic) FixMetadata(fetchAlbumImageFromRemote bool) (bool,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
} else if ncm.mFormat == Flac {
|
case Flac:
|
||||||
audioFile, err := flac.ParseFile(ncm.mDumpFilePath)
|
audioFile, err := flac.ParseFile(ncm.mDumpFilePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
@@ -235,13 +237,14 @@ func (ncm *NeteaseCloudMusic) FixMetadata(fetchAlbumImageFromRemote bool) (bool,
|
|||||||
cmts = flacvorbis.New()
|
cmts = flacvorbis.New()
|
||||||
}
|
}
|
||||||
|
|
||||||
if res, _ := cmts.Get(flacvorbis.FIELD_TITLE); res[0] != ncm.mMetadata.mName {
|
// flac 可能自带元数据 当且仅当没有该项时才向目标添加元数据
|
||||||
|
if res, _ := cmts.Get(flacvorbis.FIELD_TITLE); len(res) == 0 {
|
||||||
_ = cmts.Add(flacvorbis.FIELD_TITLE, ncm.mMetadata.mName)
|
_ = cmts.Add(flacvorbis.FIELD_TITLE, ncm.mMetadata.mName)
|
||||||
}
|
}
|
||||||
if res, _ := cmts.Get(flacvorbis.FIELD_ARTIST); res[0] != ncm.mMetadata.mArtist {
|
if res, _ := cmts.Get(flacvorbis.FIELD_ARTIST); len(res) == 0 {
|
||||||
_ = cmts.Add(flacvorbis.FIELD_ARTIST, ncm.mMetadata.mArtist)
|
_ = cmts.Add(flacvorbis.FIELD_ARTIST, ncm.mMetadata.mArtist)
|
||||||
}
|
}
|
||||||
if res, _ := cmts.Get(flacvorbis.FIELD_ALBUM); res[0] != ncm.mMetadata.mAlbum {
|
if res, _ := cmts.Get(flacvorbis.FIELD_ALBUM); len(res) == 0 {
|
||||||
_ = cmts.Add(flacvorbis.FIELD_ALBUM, ncm.mMetadata.mAlbum)
|
_ = cmts.Add(flacvorbis.FIELD_ALBUM, ncm.mMetadata.mAlbum)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user