fix #26: correctly calculate cover frame size

Signed-off-by: 鲁树人 <lu.shuren@um-react.app>
This commit is contained in:
鲁树人 2024-09-13 00:00:35 +01:00
parent 36e6801f29
commit 2b52a367f2
No known key found for this signature in database
1 changed files with 5 additions and 2 deletions

View File

@ -391,12 +391,14 @@ NeteaseCrypt::NeteaseCrypt(std::string const &path)
mMetaData = new NeteaseMusicMetadata(cJSON_Parse(modifyDecryptData.c_str())); mMetaData = new NeteaseMusicMetadata(cJSON_Parse(modifyDecryptData.c_str()));
} }
// skip crc32 & unuse charset // skip crc32 & image version
if (!mFile.seekg(9, mFile.cur)) if (!mFile.seekg(5, mFile.cur))
{ {
throw std::invalid_argument("can't seek file"); throw std::invalid_argument("can't seek file");
} }
uint32_t cover_frame_len{0};
read(reinterpret_cast<char *>(&cover_frame_len), 4);
read(reinterpret_cast<char *>(&n), sizeof(n)); read(reinterpret_cast<char *>(&n), sizeof(n));
if (n > 0) if (n > 0)
@ -410,4 +412,5 @@ NeteaseCrypt::NeteaseCrypt(std::string const &path)
{ {
std::cout << "[Warn] " << path << " missing album can't fix album image!" << std::endl; std::cout << "[Warn] " << path << " missing album can't fix album image!" << std::endl;
} }
mFile.seekg(cover_frame_len - n, mFile.cur);
} }