Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a62f5156f0 | |||
| 747343162b | |||
| 676641d5f9 | |||
| 96dc36f112 | |||
|
54da5b7a35
|
|||
|
4d0622073a
|
|||
| 49e554931e | |||
| 2814a23874 | |||
| 3a48a5d667 | |||
| 5cb53dff3b | |||
| b3258662f6 |
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2018-present TaurusXin and contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -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.2
|
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.1")
|
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,9 +237,16 @@ func (ncm *NeteaseCloudMusic) FixMetadata(fetchAlbumImageFromRemote bool) (bool,
|
|||||||
cmts = flacvorbis.New()
|
cmts = flacvorbis.New()
|
||||||
}
|
}
|
||||||
|
|
||||||
_ = cmts.Add(flacvorbis.FIELD_TITLE, ncm.mMetadata.mName)
|
// flac 可能自带元数据 当且仅当没有该项时才向目标添加元数据
|
||||||
_ = cmts.Add(flacvorbis.FIELD_ARTIST, ncm.mMetadata.mArtist)
|
if res, _ := cmts.Get(flacvorbis.FIELD_TITLE); len(res) == 0 {
|
||||||
_ = cmts.Add(flacvorbis.FIELD_ALBUM, ncm.mMetadata.mAlbum)
|
_ = cmts.Add(flacvorbis.FIELD_TITLE, ncm.mMetadata.mName)
|
||||||
|
}
|
||||||
|
if res, _ := cmts.Get(flacvorbis.FIELD_ARTIST); len(res) == 0 {
|
||||||
|
_ = cmts.Add(flacvorbis.FIELD_ARTIST, ncm.mMetadata.mArtist)
|
||||||
|
}
|
||||||
|
if res, _ := cmts.Get(flacvorbis.FIELD_ALBUM); len(res) == 0 {
|
||||||
|
_ = cmts.Add(flacvorbis.FIELD_ALBUM, ncm.mMetadata.mAlbum)
|
||||||
|
}
|
||||||
|
|
||||||
cmtsmeta := cmts.Marshal()
|
cmtsmeta := cmts.Marshal()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user