Compare commits

...

4 Commits

Author SHA1 Message Date
a4c7db8195
update: README.md 2024-10-21 16:30:46 +08:00
574a77dabe
feat: rename binary to ncmdump-go 2024-10-21 16:29:17 +08:00
b977408526
bump go-flac to v2 2024-10-21 14:23:42 +08:00
3072d7f9cf
fix: only fetch when not embedded 2024-10-21 10:41:10 +08:00
4 changed files with 30 additions and 29 deletions

View File

@ -9,44 +9,44 @@
使用 `-h``--help` 参数来打印帮助
```shell
ncmdump -h
ncmdump-go -h
```
使用 `-v``--version` 参数来打印版本信息
```shell
ncmdump -v
ncmdump-go -v
```
处理单个或多个文件
```shell
ncmdump 1.ncm 2.ncm...
ncmdump-go 1.ncm 2.ncm...
```
使用 `-d` 参数来指定一个文件夹,对文件夹下的所有以 ncm 为扩展名的文件进行批量处理
```shell
ncmdump -d source_dir
ncmdump-go -d source_dir
```
使用 `-r` 配合 `-d` 参数来递归处理文件夹下的所有以 ncm 为扩展名的文件
```shell
ncmdump -d source_dir -r
ncmdump-go -d source_dir -r
```
使用 `-o` 参数来指定输出目录,将转换后的文件输出到指定目录,该参数支持与 `-r` 参数一起使用
```shell
# 处理单个或多个文件并输出到指定目录
ncmdump 1.ncm 2.ncm -o output_dir
ncmdump-go 1.ncm 2.ncm -o output_dir
# 处理文件夹下的所有以 ncm 为扩展名并输出到指定目录,不包含子文件夹
ncmdump -d source_dir -o output_dir
ncmdump-go -d source_dir -o output_dir
# 递归处理文件夹并输出到指定目录,并保留目录结构
ncmdump -d source_dir -o output_dir -r
ncmdump-go -d source_dir -o output_dir -r
```
## 开发

View File

@ -8,30 +8,30 @@ mkdir build
# Linux amd64
echo "Building for Linux amd64..."
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o build/ncmdump github.com/taurusxin/ncmdump-go
tar zcf build/ncmdump_linux_amd64_$VERSION.tar.gz -C build ncmdump
rm build/ncmdump
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o build/ncmdump-go github.com/taurusxin/ncmdump-go
tar zcf build/ncmdump-go_linux_amd64_$VERSION.tar.gz -C build ncmdump-go
rm build/ncmdump-go
# Linux arm64
echo "Building for Linux arm64..."
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-w -s" -o build/ncmdump github.com/taurusxin/ncmdump-go
tar zcf build/ncmdump_linux_arm64_$VERSION.tar.gz -C build ncmdump
rm build/ncmdump
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags="-w -s" -o build/ncmdump-go github.com/taurusxin/ncmdump-go
tar zcf build/ncmdump-go_linux_arm64_$VERSION.tar.gz -C build ncmdump-go
rm build/ncmdump-go
# macOS amd64
echo "Building for macOS amd64..."
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="-w -s" -o build/ncmdump github.com/taurusxin/ncmdump-go
tar zcf build/ncmdump_darwin_amd64_$VERSION.tar.gz -C build ncmdump
rm build/ncmdump
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags="-w -s" -o build/ncmdump-go github.com/taurusxin/ncmdump-go
tar zcf build/ncmdump-go_darwin_amd64_$VERSION.tar.gz -C build ncmdump-go
rm build/ncmdump-go
# macOS arm64
echo "Building for macOS arm64..."
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags="-w -s" -o build/ncmdump github.com/taurusxin/ncmdump-go
tar zcf build/ncmdump_darwin_arm64_$VERSION.tar.gz -C build ncmdump
rm build/ncmdump
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags="-w -s" -o build/ncmdump-go github.com/taurusxin/ncmdump-go
tar zcf build/ncmdump-go_darwin_arm64_$VERSION.tar.gz -C build ncmdump-go
rm build/ncmdump-go
# Windows amd64
echo "Building for Windows amd64..."
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags="-w -s" -o build/ncmdump.exe github.com/taurusxin/ncmdump-go
zip -q -j build/ncmdump_windows_amd64_$VERSION.zip ./build/ncmdump.exe
rm build/ncmdump.exe
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags="-w -s" -o build/ncmdump-go.exe github.com/taurusxin/ncmdump-go
zip -q -j build/ncmdump-go_windows_amd64_$VERSION.zip ./build/ncmdump-go.exe
rm build/ncmdump-go.exe

10
go.mod
View File

@ -4,15 +4,15 @@ go 1.23.0
require github.com/tidwall/gjson v1.17.3
require github.com/go-flac/go-flac v1.0.0
require github.com/spf13/pflag v1.0.5
require github.com/bogem/id3v2/v2 v2.1.4
require github.com/go-flac/flacpicture v0.3.0
require github.com/TwiN/go-color v1.4.1
require (
github.com/TwiN/go-color v1.4.1
github.com/go-flac/flacpicture v0.3.0
github.com/go-flac/go-flac v1.0.0
)
require (
github.com/tidwall/match v1.1.1 // indirect

View File

@ -161,7 +161,8 @@ func (ncm *NeteaseCloudMusic) Dump(targetDir string) (bool, error) {
// 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) {
if fetchAlbumImageFromRemote {
// only fetch album image from remote when it's not embedded in the ncm file
if len(ncm.mImageData) <= 0 && fetchAlbumImageFromRemote {
// get the album pic from url
resp, err := http.Get(ncm.mAlbumPicUrl)
if err != nil {