1
0
forked from um/cli

feat: add tips for QMC with STag suffix

This commit is contained in:
Unlock Music Dev 2022-11-19 07:25:36 +08:00
parent 9647ca15fd
commit 7b37e4dd3c
Signed by untrusted user: um-dev
GPG Key ID: 95202E10D3413A1D

View File

@ -91,7 +91,7 @@ func (d *Decoder) Validate() error {
return nil return nil
} }
func (d Decoder) GetFileExt() string { func (d *Decoder) GetFileExt() string {
return d.fileExt return d.fileExt
} }
@ -105,21 +105,19 @@ func (d *Decoder) searchKey() error {
return err return err
} }
if string(buf) == "QTag" { if string(buf) == "QTag" {
if err := d.readRawMetaQTag(); err != nil { return d.readRawMetaQTag()
return err } else if string(buf) == "STag" {
} return errors.New("qmc: file with 'STag' suffix doesn't contains media key")
} else { } else {
size := binary.LittleEndian.Uint32(buf) size := binary.LittleEndian.Uint32(buf)
if size < 0x300 && size != 0 { if size < 0x300 && size != 0 {
return d.readRawKey(int64(size)) return d.readRawKey(int64(size))
} else { }
// try to use default static cipher // try to use default static cipher
d.audioLen = int(fileSizeM4 + 4) d.audioLen = int(fileSizeM4 + 4)
return nil return nil
} }
} }
return nil
}
func (d *Decoder) readRawKey(rawKeyLen int64) error { func (d *Decoder) readRawKey(rawKeyLen int64) error {
audioLen, err := d.r.Seek(-(4 + rawKeyLen), io.SeekEnd) audioLen, err := d.r.Seek(-(4 + rawKeyLen), io.SeekEnd)