fix新增过滤纯音乐

This commit is contained in:
Yutousama 2022-11-14 14:08:27 +08:00
parent e58cb29656
commit eab928a111

View File

@ -120,11 +120,7 @@ public class MusicToolsServiceImpl implements IMusicToolsService {
tmpPath = AppData.defaultMusicPath; tmpPath = AppData.defaultMusicPath;
} }
if (isDir) { if (isDir) {
if (filter) {
example.createCriteria().andFileLike(tmpPath.replace(File.separator, replacement) + "%").andTitleNotLike("instrumental");
} else {
example.createCriteria().andFileLike(tmpPath.replace(File.separator, replacement) + "%"); example.createCriteria().andFileLike(tmpPath.replace(File.separator, replacement) + "%");
}
main = musicDataDao.selectByExample(example, delPath); main = musicDataDao.selectByExample(example, delPath);
}else { }else {
tmpPath = tmpPath.replace(File.separator, replacement) tmpPath = tmpPath.replace(File.separator, replacement)
@ -133,7 +129,7 @@ public class MusicToolsServiceImpl implements IMusicToolsService {
.replace("(", "\\(") .replace("(", "\\(")
.replace(")", "\\)") .replace(")", "\\)")
.replace("]", "\\]"); .replace("]", "\\]");
main.addAll(musicDataDao.selectByRegexp(tmpPath + replacement + "([^" + replacement + "]+)$", delPath)); main = new ArrayList<>(musicDataDao.selectByRegexp(tmpPath + replacement + "([^" + replacement + "]+)$", delPath));
} }
if (!path.equals(AppData.defaultMusicPath) && !"root".equals(path)) { if (!path.equals(AppData.defaultMusicPath) && !"root".equals(path)) {
@ -159,7 +155,7 @@ public class MusicToolsServiceImpl implements IMusicToolsService {
Comparator<Object> compare = Collator.getInstance(Locale.CHINA); Comparator<Object> compare = Collator.getInstance(Locale.CHINA);
return compare.compare(o1.getTitle(), o2.getTitle()); return compare.compare(o1.getTitle(), o2.getTitle());
}); });
if(filter){ if (filter) {
list.removeIf(data -> data.getTitle().contains("instrumental")); list.removeIf(data -> data.getTitle().contains("instrumental"));
} }
return list; return list;