update:音乐列表输出排序

This commit is contained in:
Yutousama 2022-06-12 00:58:04 +08:00
parent 25e1ddca64
commit 66c77b04b9
2 changed files with 11 additions and 8 deletions

View File

@ -12,7 +12,8 @@ import org.springframework.context.annotation.Import;
@Import(BTDownloadManager.class)
@SpringBootApplication
public class NasApplication {
public static final String version="1.2.13";
public static final String version = "1.2.14";
public static void main(String[] args) {
SpringApplication.run(NasApplication.class, args);
AppData.defaultMusicPath = (String) ConfigTools.load(ConfigTools.CONFIG, "musicDir");

View File

@ -1,12 +1,10 @@
package com.yutou.nas.Services.impl;
import com.alibaba.fastjson2.JSONObject;
import com.yutou.nas.Datas.AppData;
import com.yutou.nas.Services.IMusicToolsService;
import com.yutou.nas.mybatis.dao.MusicDataDao;
import com.yutou.nas.mybatis.model.MusicData;
import com.yutou.nas.mybatis.model.MusicDataExample;
import com.yutou.nas.Services.IMusicToolsService;
import com.yutou.nas.utils.*;
import ealvatag.audio.AudioFile;
import ealvatag.audio.AudioFileIO;
@ -26,10 +24,8 @@ import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.text.Collator;
import java.util.*;
@Service("MusicToolsService")
public class MusicToolsServiceImpl implements IMusicToolsService {
@ -146,6 +142,12 @@ public class MusicToolsServiceImpl implements IMusicToolsService {
}
getDirList(path, list);
list.addAll(main);
list.sort((o1, o2) -> {
Comparator<Object> compare = Collator.getInstance(Locale.CHINA);
return compare.compare(o1.getTitle(),o2.getTitle());
});
return list;
}