修复音乐返回异常问题
This commit is contained in:
parent
4b91b65d43
commit
4ffd94e3d1
@ -56,7 +56,7 @@ public class MusicToolsServiceImpl implements IMusicToolsService {
|
||||
if (isScan) {
|
||||
return;
|
||||
}
|
||||
if (!ConfigTools.load(ConfigTools.CONFIG, "musicScan",boolean.class,false)) {
|
||||
if (!ConfigTools.load(ConfigTools.CONFIG, "musicScan", boolean.class, false)) {
|
||||
return;
|
||||
}
|
||||
musicPath = (String) ConfigTools.load(ConfigTools.CONFIG, "musicDir");
|
||||
@ -132,8 +132,7 @@ public class MusicToolsServiceImpl implements IMusicToolsService {
|
||||
if (main.isEmpty()) {
|
||||
t2.setFile("root");
|
||||
} else {
|
||||
MusicData tmp = main.get(0);
|
||||
t2.setFile(new File(tmp.getLastdir()).getAbsolutePath());
|
||||
t2.setFile(new File(path).getParent());
|
||||
}
|
||||
com.yutou.nas.utils.Log.i("查询地址:" + path + " 设置返回地址:" + t2.getFile());
|
||||
t2.setIsdir(1);
|
||||
@ -162,8 +161,8 @@ public class MusicToolsServiceImpl implements IMusicToolsService {
|
||||
|
||||
private void getDirList(String path, List<MusicData> list) {
|
||||
File file = new File(path);
|
||||
com.yutou.nas.utils.Log.i("扫描文件:"+path);
|
||||
if(file.isDirectory()) {
|
||||
com.yutou.nas.utils.Log.i("扫描文件:" + path);
|
||||
if (file.isDirectory()) {
|
||||
for (File listFile : file.listFiles()) {
|
||||
if (listFile.isDirectory()) {
|
||||
MusicData data = new MusicData();
|
||||
@ -173,7 +172,7 @@ public class MusicToolsServiceImpl implements IMusicToolsService {
|
||||
list.add(data);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
MusicData data = new MusicData();
|
||||
data.setTitle(file.getName());
|
||||
data.setIsdir(0);
|
||||
@ -186,8 +185,8 @@ public class MusicToolsServiceImpl implements IMusicToolsService {
|
||||
MusicData data = getMetadata(file);
|
||||
if (data != null) {
|
||||
try {
|
||||
if(getMusicData(file.getAbsolutePath())==null) {
|
||||
// System.out.println(data);
|
||||
if (getMusicData(file.getAbsolutePath()) == null) {
|
||||
// System.out.println(data);
|
||||
musicDataDao.insert(data);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
Loading…
Reference in New Issue
Block a user