mirror of
https://git.um-react.app/um/cli.git
synced 2025-11-28 03:33:02 +00:00
feat(ncm): support audio meta getter
This commit is contained in:
@@ -29,6 +29,7 @@ func RegisterDecoder(ext string, noop bool, dispatchFunc NewDecoderFunc) {
|
||||
DecoderRegistry[ext] = append(DecoderRegistry[ext],
|
||||
decoderItem{noop: noop, decoder: dispatchFunc})
|
||||
}
|
||||
|
||||
func GetDecoder(filename string, skipNoop bool) (rs []NewDecoderFunc) {
|
||||
ext := strings.ToLower(strings.TrimLeft(filepath.Ext(filename), "."))
|
||||
for _, dec := range DecoderRegistry[ext] {
|
||||
|
||||
@@ -5,6 +5,10 @@ import (
|
||||
"io"
|
||||
)
|
||||
|
||||
type StreamDecoder interface {
|
||||
Decrypt(buf []byte, offset int)
|
||||
}
|
||||
|
||||
type Decoder interface {
|
||||
Validate() error
|
||||
io.Reader
|
||||
@@ -14,12 +18,12 @@ type CoverImageGetter interface {
|
||||
GetCoverImage(ctx context.Context) ([]byte, error)
|
||||
}
|
||||
|
||||
type Meta interface {
|
||||
type AudioMeta interface {
|
||||
GetArtists() []string
|
||||
GetTitle() string
|
||||
GetAlbum() string
|
||||
}
|
||||
|
||||
type StreamDecoder interface {
|
||||
Decrypt(buf []byte, offset int)
|
||||
type AudioMetaGetter interface {
|
||||
GetAudioMeta(ctx context.Context) (AudioMeta, error)
|
||||
}
|
||||
Reference in New Issue
Block a user