Compare commits
2 Commits
a4c7db8195
...
5862d7a8d8
Author | SHA1 | Date | |
---|---|---|---|
5862d7a8d8 | |||
be81c22e49 |
2
build.sh
2
build.sh
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
VERSION=1.6.0
|
VERSION=1.7.0
|
||||||
|
|
||||||
# Clean up the build directory
|
# Clean up the build directory
|
||||||
rm -rf build
|
rm -rf build
|
||||||
|
1
go.mod
1
go.mod
@ -11,6 +11,7 @@ require github.com/bogem/id3v2/v2 v2.1.4
|
|||||||
require (
|
require (
|
||||||
github.com/TwiN/go-color v1.4.1
|
github.com/TwiN/go-color v1.4.1
|
||||||
github.com/go-flac/flacpicture v0.3.0
|
github.com/go-flac/flacpicture v0.3.0
|
||||||
|
github.com/go-flac/flacvorbis v0.2.0
|
||||||
github.com/go-flac/go-flac v1.0.0
|
github.com/go-flac/go-flac v1.0.0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
2
go.sum
2
go.sum
@ -4,6 +4,8 @@ github.com/bogem/id3v2/v2 v2.1.4 h1:CEwe+lS2p6dd9UZRlPc1zbFNIha2mb2qzT1cCEoNWoI=
|
|||||||
github.com/bogem/id3v2/v2 v2.1.4/go.mod h1:l+gR8MZ6rc9ryPTPkX77smS5Me/36gxkMgDayZ9G1vY=
|
github.com/bogem/id3v2/v2 v2.1.4/go.mod h1:l+gR8MZ6rc9ryPTPkX77smS5Me/36gxkMgDayZ9G1vY=
|
||||||
github.com/go-flac/flacpicture v0.3.0 h1:LkmTxzFLIynwfhHiZsX0s8xcr3/u33MzvV89u+zOT8I=
|
github.com/go-flac/flacpicture v0.3.0 h1:LkmTxzFLIynwfhHiZsX0s8xcr3/u33MzvV89u+zOT8I=
|
||||||
github.com/go-flac/flacpicture v0.3.0/go.mod h1:DPbrzVYQ3fJcvSgLFp9HXIrEQEdfdk/+m0nQCzwodZI=
|
github.com/go-flac/flacpicture v0.3.0/go.mod h1:DPbrzVYQ3fJcvSgLFp9HXIrEQEdfdk/+m0nQCzwodZI=
|
||||||
|
github.com/go-flac/flacvorbis v0.2.0 h1:KH0xjpkNTXFER4cszH4zeJxYcrHbUobz/RticWGOESs=
|
||||||
|
github.com/go-flac/flacvorbis v0.2.0/go.mod h1:uIysHOtuU7OLGoCRG92bvnkg7QEqHx19qKRV6K1pBrI=
|
||||||
github.com/go-flac/go-flac v1.0.0 h1:6qI9XOVLcO50xpzm3nXvO31BgDgHhnr/p/rER/K/doY=
|
github.com/go-flac/go-flac v1.0.0 h1:6qI9XOVLcO50xpzm3nXvO31BgDgHhnr/p/rER/K/doY=
|
||||||
github.com/go-flac/go-flac v1.0.0/go.mod h1:WnZhcpmq4u1UdZMNn9LYSoASpWOCMOoxXxcWEHSzkW8=
|
github.com/go-flac/go-flac v1.0.0/go.mod h1:WnZhcpmq4u1UdZMNn9LYSoASpWOCMOoxXxcWEHSzkW8=
|
||||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||||
|
2
main.go
2
main.go
@ -59,7 +59,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if *showVersion {
|
if *showVersion {
|
||||||
fmt.Println("ncmdump version 1.6.0")
|
fmt.Println("ncmdump version 1.7.0")
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"github.com/bogem/id3v2/v2"
|
"github.com/bogem/id3v2/v2"
|
||||||
"github.com/go-flac/flacpicture"
|
"github.com/go-flac/flacpicture"
|
||||||
|
"github.com/go-flac/flacvorbis"
|
||||||
"github.com/go-flac/go-flac"
|
"github.com/go-flac/go-flac"
|
||||||
"github.com/taurusxin/ncmdump-go/utils"
|
"github.com/taurusxin/ncmdump-go/utils"
|
||||||
"io"
|
"io"
|
||||||
@ -217,12 +218,36 @@ func (ncm *NeteaseCloudMusic) FixMetadata(fetchAlbumImageFromRemote bool) (bool,
|
|||||||
pictureMeta := pic.Marshal()
|
pictureMeta := pic.Marshal()
|
||||||
audioFile.Meta = append(audioFile.Meta, &pictureMeta)
|
audioFile.Meta = append(audioFile.Meta, &pictureMeta)
|
||||||
}
|
}
|
||||||
generalMeta := &flac.MetaDataBlock{
|
|
||||||
Type: flac.VorbisComment,
|
var cmts *flacvorbis.MetaDataBlockVorbisComment
|
||||||
Data: []byte(fmt.Sprintf("title=%s\nartist=%s\nalbum=%s", ncm.mMetadata.mName, ncm.mMetadata.mArtist, ncm.mMetadata.mAlbum)),
|
var cmtIdx int
|
||||||
|
for idx, meta := range audioFile.Meta {
|
||||||
|
if meta.Type == flac.VorbisComment {
|
||||||
|
cmts, err = flacvorbis.ParseFromMetaDataBlock(*meta)
|
||||||
|
cmtIdx = idx
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
audioFile.Meta = append(audioFile.Meta, generalMeta)
|
if cmts == nil && cmtIdx > 0 {
|
||||||
|
cmts = flacvorbis.New()
|
||||||
|
}
|
||||||
|
|
||||||
|
_ = cmts.Add(flacvorbis.FIELD_TITLE, ncm.mMetadata.mName)
|
||||||
|
_ = cmts.Add(flacvorbis.FIELD_ARTIST, ncm.mMetadata.mArtist)
|
||||||
|
_ = cmts.Add(flacvorbis.FIELD_ALBUM, ncm.mMetadata.mAlbum)
|
||||||
|
|
||||||
|
cmtsmeta := cmts.Marshal()
|
||||||
|
|
||||||
|
if cmtIdx > 0 {
|
||||||
|
audioFile.Meta[cmtIdx] = &cmtsmeta
|
||||||
|
} else {
|
||||||
|
audioFile.Meta = append(audioFile.Meta, &cmtsmeta)
|
||||||
|
}
|
||||||
|
|
||||||
err = audioFile.Save(ncm.mDumpFilePath)
|
err = audioFile.Save(ncm.mDumpFilePath)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user