add新增过滤纯音乐
This commit is contained in:
parent
a39d99eeb6
commit
3509de8cef
@ -47,20 +47,21 @@ public class MusicController {
|
|||||||
public String getMusicListOfPath(@RequestBody JSONObject body) {
|
public String getMusicListOfPath(@RequestBody JSONObject body) {
|
||||||
String path = body.getString("path");
|
String path = body.getString("path");
|
||||||
boolean type = body.containsKey("type") ? body.getBoolean("type") : false;
|
boolean type = body.containsKey("type") ? body.getBoolean("type") : false;
|
||||||
|
boolean filter = body.containsKey("filter") ? body.getBoolean("filter") : false;
|
||||||
if (StringUtils.isEmpty(path)
|
if (StringUtils.isEmpty(path)
|
||||||
|| "root".equals(path)
|
|| "root".equals(path)
|
||||||
|| !path.contains(defaultMusicPath)
|
|| !path.contains(defaultMusicPath)
|
||||||
) {
|
) {
|
||||||
path = defaultMusicPath;
|
path = defaultMusicPath;
|
||||||
}
|
}
|
||||||
com.yutou.nas.utils.Log.i("接收到地址:" + path);
|
com.yutou.nas.utils.Log.i("接收到地址:" + body);
|
||||||
|
|
||||||
//path=path.replace(defaultMusicPath+File.separator,"");
|
//path=path.replace(defaultMusicPath+File.separator,"");
|
||||||
JSONObject json = new JSONObject();
|
JSONObject json = new JSONObject();
|
||||||
json.put("code", 0);
|
json.put("code", 0);
|
||||||
json.put("scan", musicTools.isScan());
|
json.put("scan", musicTools.isScan());
|
||||||
json.put("size", musicTools.getLength());
|
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();
|
return json.toJSONString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,6 +190,7 @@ public class MusicController {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/nas/music/lrc.do")
|
@RequestMapping("/nas/music/lrc.do")
|
||||||
public ResponseEntity<FileSystemResource> lrc(String filePath) {
|
public ResponseEntity<FileSystemResource> lrc(String filePath) {
|
||||||
return Tools.getFile(musicTools.getMusicLrcMd5(filePath));
|
return Tools.getFile(musicTools.getMusicLrcMd5(filePath));
|
||||||
|
@ -12,6 +12,7 @@ public interface IMusicToolsService {
|
|||||||
void scanMusic();
|
void scanMusic();
|
||||||
|
|
||||||
List<MusicData> getPath(String path, boolean isDir,boolean delPath);
|
List<MusicData> getPath(String path, boolean isDir,boolean delPath);
|
||||||
|
List<MusicData> getPath(String path, boolean isDir,boolean delPath,boolean filter);
|
||||||
|
|
||||||
MusicData getMusicDataOfMd5(String md5,boolean isDelFile);
|
MusicData getMusicDataOfMd5(String md5,boolean isDelFile);
|
||||||
MusicData getMusicData(String path,boolean isDelFile);
|
MusicData getMusicData(String path,boolean isDelFile);
|
||||||
|
@ -97,6 +97,10 @@ public class MusicToolsServiceImpl implements IMusicToolsService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MusicData> getPath(String path, boolean isDir, boolean delPath) {
|
||||||
|
return getPath(path, isDir, delPath, false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取指定目录下的音乐
|
* 获取指定目录下的音乐
|
||||||
@ -106,7 +110,7 @@ public class MusicToolsServiceImpl implements IMusicToolsService {
|
|||||||
* @return 音乐列表
|
* @return 音乐列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<MusicData> getPath(String path, boolean isDir,boolean delPath) {
|
public List<MusicData> getPath(String path, boolean isDir, boolean delPath, boolean filter) {
|
||||||
List<MusicData> list = new ArrayList<>();
|
List<MusicData> list = new ArrayList<>();
|
||||||
List<MusicData> main = new ArrayList<>();
|
List<MusicData> main = new ArrayList<>();
|
||||||
MusicDataExample example = new MusicDataExample();
|
MusicDataExample example = new MusicDataExample();
|
||||||
@ -116,7 +120,11 @@ 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);
|
||||||
}
|
}
|
||||||
tmpPath = tmpPath.replace(File.separator, replacement)
|
tmpPath = tmpPath.replace(File.separator, replacement)
|
||||||
@ -155,7 +163,6 @@ public class MusicToolsServiceImpl implements IMusicToolsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public List<MusicData> getAllAlbum() {
|
public List<MusicData> getAllAlbum() {
|
||||||
return musicDataDao.selectAllAlbum();
|
return musicDataDao.selectAllAlbum();
|
||||||
}
|
}
|
||||||
@ -220,6 +227,7 @@ public class MusicToolsServiceImpl implements IMusicToolsService {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MusicData getMusicDataOfMd5(String md5, boolean isDelFile) {
|
public MusicData getMusicDataOfMd5(String md5, boolean isDelFile) {
|
||||||
MusicDataExample example = new MusicDataExample();
|
MusicDataExample example = new MusicDataExample();
|
||||||
|
Loading…
Reference in New Issue
Block a user