From 7b37e4dd3c20310096864e4881e3d6bc4db48e71 Mon Sep 17 00:00:00 2001 From: Unlock Music Dev Date: Sat, 19 Nov 2022 07:25:36 +0800 Subject: [PATCH] feat: add tips for QMC with STag suffix --- algo/qmc/qmc.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/algo/qmc/qmc.go b/algo/qmc/qmc.go index de7b06e..6be2a59 100644 --- a/algo/qmc/qmc.go +++ b/algo/qmc/qmc.go @@ -91,7 +91,7 @@ func (d *Decoder) Validate() error { return nil } -func (d Decoder) GetFileExt() string { +func (d *Decoder) GetFileExt() string { return d.fileExt } @@ -105,20 +105,18 @@ func (d *Decoder) searchKey() error { return err } if string(buf) == "QTag" { - if err := d.readRawMetaQTag(); err != nil { - return err - } + return d.readRawMetaQTag() + } else if string(buf) == "STag" { + return errors.New("qmc: file with 'STag' suffix doesn't contains media key") } else { size := binary.LittleEndian.Uint32(buf) if size < 0x300 && size != 0 { return d.readRawKey(int64(size)) - } else { - // try to use default static cipher - d.audioLen = int(fileSizeM4 + 4) - return nil } + // try to use default static cipher + d.audioLen = int(fileSizeM4 + 4) + return nil } - return nil } func (d *Decoder) readRawKey(rawKeyLen int64) error {