fix新增过滤纯音乐

This commit is contained in:
Yutousama 2022-11-14 15:03:04 +08:00
parent eab928a111
commit 3cf9b7da7e

View File

@ -163,8 +163,15 @@ public class MusicController {
@RequestMapping("/nas/music/random.do")
@ResponseBody
public String random() {
public String random(String filter) {
boolean _fieldName = false;
if(!StringUtils.isEmpty(filter)){
_fieldName="true".equals(filter);
}
List<MusicData> list = musicTools.getMusicList(true);
if(_fieldName) {
list.removeIf(data -> data.getTitle().contains("instrumental"));
}
MusicData data = list.get(Tools.randomCommon(0, list.size() - 1, 1)[0]);
JSONObject json = new JSONObject();
json.put("code", 0);