Compare commits
4 Commits
cf39731cb4
...
a4c7db8195
Author | SHA1 | Date | |
---|---|---|---|
a4c7db8195 | |||
574a77dabe | |||
b977408526 | |||
3072d7f9cf |
16
README.md
16
README.md
@ -9,44 +9,44 @@
|
|||||||
使用 `-h` 或 `--help` 参数来打印帮助
|
使用 `-h` 或 `--help` 参数来打印帮助
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
ncmdump -h
|
ncmdump-go -h
|
||||||
```
|
```
|
||||||
|
|
||||||
使用 `-v` 或 `--version` 参数来打印版本信息
|
使用 `-v` 或 `--version` 参数来打印版本信息
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
ncmdump -v
|
ncmdump-go -v
|
||||||
```
|
```
|
||||||
|
|
||||||
处理单个或多个文件
|
处理单个或多个文件
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
ncmdump 1.ncm 2.ncm...
|
ncmdump-go 1.ncm 2.ncm...
|
||||||
```
|
```
|
||||||
|
|
||||||
使用 `-d` 参数来指定一个文件夹,对文件夹下的所有以 ncm 为扩展名的文件进行批量处理
|
使用 `-d` 参数来指定一个文件夹,对文件夹下的所有以 ncm 为扩展名的文件进行批量处理
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
ncmdump -d source_dir
|
ncmdump-go -d source_dir
|
||||||
```
|
```
|
||||||
|
|
||||||
使用 `-r` 配合 `-d` 参数来递归处理文件夹下的所有以 ncm 为扩展名的文件
|
使用 `-r` 配合 `-d` 参数来递归处理文件夹下的所有以 ncm 为扩展名的文件
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
ncmdump -d source_dir -r
|
ncmdump-go -d source_dir -r
|
||||||
```
|
```
|
||||||
|
|
||||||
使用 `-o` 参数来指定输出目录,将转换后的文件输出到指定目录,该参数支持与 `-r` 参数一起使用
|
使用 `-o` 参数来指定输出目录,将转换后的文件输出到指定目录,该参数支持与 `-r` 参数一起使用
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
# 处理单个或多个文件并输出到指定目录
|
# 处理单个或多个文件并输出到指定目录
|
||||||
ncmdump 1.ncm 2.ncm -o output_dir
|
ncmdump-go 1.ncm 2.ncm -o output_dir
|
||||||
|
|
||||||
# 处理文件夹下的所有以 ncm 为扩展名并输出到指定目录,不包含子文件夹
|
# 处理文件夹下的所有以 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
|
||||||
```
|
```
|
||||||
|
|
||||||
## 开发
|
## 开发
|
||||||
|
30
build.sh
30
build.sh
@ -8,30 +8,30 @@ mkdir build
|
|||||||
|
|
||||||
# Linux amd64
|
# Linux amd64
|
||||||
echo "Building for 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
|
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_linux_amd64_$VERSION.tar.gz -C build ncmdump
|
tar zcf build/ncmdump-go_linux_amd64_$VERSION.tar.gz -C build ncmdump-go
|
||||||
rm build/ncmdump
|
rm build/ncmdump-go
|
||||||
|
|
||||||
# Linux arm64
|
# Linux arm64
|
||||||
echo "Building for 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
|
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_linux_arm64_$VERSION.tar.gz -C build ncmdump
|
tar zcf build/ncmdump-go_linux_arm64_$VERSION.tar.gz -C build ncmdump-go
|
||||||
rm build/ncmdump
|
rm build/ncmdump-go
|
||||||
|
|
||||||
# macOS amd64
|
# macOS amd64
|
||||||
echo "Building for 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
|
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_darwin_amd64_$VERSION.tar.gz -C build ncmdump
|
tar zcf build/ncmdump-go_darwin_amd64_$VERSION.tar.gz -C build ncmdump-go
|
||||||
rm build/ncmdump
|
rm build/ncmdump-go
|
||||||
|
|
||||||
# macOS arm64
|
# macOS arm64
|
||||||
echo "Building for 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
|
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_darwin_arm64_$VERSION.tar.gz -C build ncmdump
|
tar zcf build/ncmdump-go_darwin_arm64_$VERSION.tar.gz -C build ncmdump-go
|
||||||
rm build/ncmdump
|
rm build/ncmdump-go
|
||||||
|
|
||||||
# Windows amd64
|
# Windows amd64
|
||||||
echo "Building for 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
|
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_windows_amd64_$VERSION.zip ./build/ncmdump.exe
|
zip -q -j build/ncmdump-go_windows_amd64_$VERSION.zip ./build/ncmdump-go.exe
|
||||||
rm build/ncmdump.exe
|
rm build/ncmdump-go.exe
|
10
go.mod
10
go.mod
@ -4,15 +4,15 @@ go 1.23.0
|
|||||||
|
|
||||||
require github.com/tidwall/gjson v1.17.3
|
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/spf13/pflag v1.0.5
|
||||||
|
|
||||||
require github.com/bogem/id3v2/v2 v2.1.4
|
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 (
|
require (
|
||||||
github.com/tidwall/match v1.1.1 // indirect
|
github.com/tidwall/match v1.1.1 // indirect
|
||||||
|
@ -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.
|
// 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)
|
// 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 {
|
// 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
|
// get the album pic from url
|
||||||
resp, err := http.Get(ncm.mAlbumPicUrl)
|
resp, err := http.Get(ncm.mAlbumPicUrl)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user