music:新增歌词接口
This commit is contained in:
parent
3997ee91ac
commit
e090e6375e
@ -189,6 +189,10 @@ public class MusicController {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@RequestMapping("/nas/music/lrc.do")
|
||||
public ResponseEntity<FileSystemResource> lrc(String filePath){
|
||||
return Tools.getFile(musicTools.getMusicLrcMd5(filePath));
|
||||
}
|
||||
|
||||
@RequestMapping("/nas/music/share.do")
|
||||
@ResponseBody
|
||||
|
@ -12,7 +12,7 @@ import org.springframework.context.annotation.Import;
|
||||
@Import(BTDownloadManager.class)
|
||||
@SpringBootApplication
|
||||
public class NasApplication {
|
||||
public static final String version = "1.2.15";
|
||||
public static final String version = "1.2.16";
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(NasApplication.class, args);
|
||||
|
@ -31,4 +31,6 @@ public interface IMusicToolsService {
|
||||
byte[] readImage(String path) throws Exception;
|
||||
|
||||
File getMusicOfMd5(String md5,boolean isDelFile);
|
||||
|
||||
File getMusicLrcMd5(String md5);
|
||||
}
|
||||
|
@ -562,6 +562,23 @@ public class MusicToolsServiceImpl implements IMusicToolsService {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getMusicLrcMd5(String md5) {
|
||||
MusicDataExample example=new MusicDataExample();
|
||||
example.createCriteria().andMd5EqualTo(md5);
|
||||
List<MusicData> list=musicDataDao.selectByExample(example,false);
|
||||
if(!list.isEmpty()){
|
||||
String fileName=list.get(0).getFile();
|
||||
fileName=fileName.replace(fileName.substring(fileName.lastIndexOf(".")),".lrc");
|
||||
System.out.println("fileName = " + fileName);
|
||||
File file=new File(fileName);
|
||||
if(file.exists()){
|
||||
return file;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private byte[] readImageFile(File file) throws Exception {
|
||||
String path = file.getAbsolutePath().replace(file.getName(), "");
|
||||
File img = new File(path, "cover.jpg");
|
||||
@ -583,6 +600,8 @@ public class MusicToolsServiceImpl implements IMusicToolsService {
|
||||
file = new File("Z:\\音乐\\终将成为你\\[OP]君にふれて\\rise.flac");
|
||||
// file = new File("Z:\\音乐\\周董\\2012 十二新作\\03 公公偏头痛.ape");
|
||||
com.yutou.nas.utils.Log.i(new MusicToolsServiceImpl().getMetadataOfFFmpeg(file));
|
||||
|
||||
new MusicToolsServiceImpl().getMusicLrcMd5("84d3180883e6447c3b86bfc55b05608e");
|
||||
}
|
||||
|
||||
|
||||
|
@ -287,6 +287,9 @@ public class Tools {
|
||||
* @return 前端获取的文件
|
||||
*/
|
||||
public static ResponseEntity<FileSystemResource> getFile(File file) {
|
||||
if(file==null){
|
||||
return null;
|
||||
}
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.add("Cache-Control", "no-cache, no-store, must-revalidate");
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user