fix md5 is null bug

This commit is contained in:
Yutousama 2022-12-08 16:20:34 +08:00
parent 007184031b
commit 0be4bef30e

View File

@ -251,6 +251,8 @@ public class MusicToolsServiceImpl implements IMusicToolsService {
|| file.getName().endsWith(".dff")
|| file.getName().endsWith(".cue")
|| file.getName().endsWith(".m3u")
|| file.getName().endsWith(".txt")
|| file.getName().endsWith(".db")
) {
return null;
}
@ -314,6 +316,9 @@ public class MusicToolsServiceImpl implements IMusicToolsService {
data.setVariablebitrate(header.isVariableBitRate() ? 1 : 0);
try {
data.setMd5(header.getClass().getMethod("getMd5").invoke(header).toString());
if(data.getMd5().startsWith("00000")&&data.getMd5().endsWith("00000")){
throw new NullPointerException("md5 is null");
}
} catch (Exception ignored) {
data.setMd5(Tools.getFileMD5(file));
}
@ -387,6 +392,9 @@ public class MusicToolsServiceImpl implements IMusicToolsService {
data.setVariablebitrate(header.isVariableBitRate() ? 1 : 0);
try {
data.setMd5(header.getClass().getMethod("getMd5").invoke(header).toString());
if(data.getMd5().startsWith("00000")&&data.getMd5().endsWith("00000")){
throw new NullPointerException("md5 is null");
}
} catch (Exception ignored) {
data.setMd5(Tools.getFileMD5(file));
}