add新增过滤纯音乐
This commit is contained in:
@@ -47,20 +47,21 @@ public class MusicController {
|
||||
public String getMusicListOfPath(@RequestBody JSONObject body) {
|
||||
String path = body.getString("path");
|
||||
boolean type = body.containsKey("type") ? body.getBoolean("type") : false;
|
||||
boolean filter = body.containsKey("filter") ? body.getBoolean("filter") : false;
|
||||
if (StringUtils.isEmpty(path)
|
||||
|| "root".equals(path)
|
||||
|| !path.contains(defaultMusicPath)
|
||||
) {
|
||||
path = defaultMusicPath;
|
||||
}
|
||||
com.yutou.nas.utils.Log.i("接收到地址:" + path);
|
||||
com.yutou.nas.utils.Log.i("接收到地址:" + body);
|
||||
|
||||
//path=path.replace(defaultMusicPath+File.separator,"");
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("code", 0);
|
||||
json.put("scan", musicTools.isScan());
|
||||
json.put("size", musicTools.getLength());
|
||||
json.put("data", JSON.toJSON(musicTools.getPath(path, type, true)));
|
||||
json.put("data", JSON.toJSON(musicTools.getPath(path, type, true, filter)));
|
||||
return json.toJSONString();
|
||||
}
|
||||
|
||||
@@ -189,8 +190,9 @@ public class MusicController {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("/nas/music/lrc.do")
|
||||
public ResponseEntity<FileSystemResource> lrc(String filePath){
|
||||
public ResponseEntity<FileSystemResource> lrc(String filePath) {
|
||||
return Tools.getFile(musicTools.getMusicLrcMd5(filePath));
|
||||
}
|
||||
|
||||
@@ -235,8 +237,8 @@ public class MusicController {
|
||||
array.add(musicTools.getMusicData(file.getAbsolutePath(), true));
|
||||
} else {
|
||||
for (File listFile : Objects.requireNonNull(file.listFiles())) {
|
||||
MusicData data=musicTools.getMusicData(listFile.getAbsolutePath(), true);
|
||||
if(data!=null) {
|
||||
MusicData data = musicTools.getMusicData(listFile.getAbsolutePath(), true);
|
||||
if (data != null) {
|
||||
array.add(data);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user