refactor: improve mmkv logic

This commit is contained in:
鲁树人
2025-09-06 23:44:07 +09:00
parent 92ad51402e
commit 9b0455b0fd
10 changed files with 216 additions and 160 deletions

View File

@@ -6,8 +6,24 @@ import (
"strings"
"go.uber.org/zap"
"unlock-music.dev/cli/internal/utils"
)
type QMCKeys map[string]string
type CryptoParams struct {
// KuGou kgg database path
KggDbPath string
// QMC Crypto config
QmcKeys QMCKeys
}
func (k QMCKeys) Get(key string) (string, bool) {
value, ok := k[utils.NormalizeUnicode(key)]
return value, ok
}
type DecoderParams struct {
Reader io.ReadSeeker // required
Extension string // required, source extension, eg. ".mp3"
@@ -16,8 +32,7 @@ type DecoderParams struct {
Logger *zap.Logger // required
// KuGou
KggDatabasePath string
CryptoParams CryptoParams
}
type NewDecoderFunc func(p *DecoderParams) Decoder