修复音乐文件获取为空的问题

This commit is contained in:
Yutousama 2021-12-28 14:31:45 +08:00
parent 8ef33f382e
commit 006fb8c836
4 changed files with 8 additions and 5 deletions

View File

@ -96,7 +96,7 @@
<dependency> <dependency>
<groupId>net.mamoe</groupId> <groupId>net.mamoe</groupId>
<artifactId>mirai-core-jvm</artifactId> <artifactId>mirai-core-jvm</artifactId>
<version>2.7.0</version> <version>2.7.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.jetbrains.kotlinx</groupId> <groupId>org.jetbrains.kotlinx</groupId>

View File

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

View File

@ -114,6 +114,9 @@ public class MusicToolsServiceImpl implements IMusicToolsService {
MusicDataExample example = new MusicDataExample(); MusicDataExample example = new MusicDataExample();
String replacement = "windows".equals(ConfigTools.load(ConfigTools.CONFIG, "os")) ? "\\\\" : "/"; String replacement = "windows".equals(ConfigTools.load(ConfigTools.CONFIG, "os")) ? "\\\\" : "/";
String tmpPath = path; String tmpPath = path;
if(StringUtils.isEmpty(path)){
tmpPath=AppData.defaultMusicPath;
}
if (isDir) { if (isDir) {
example.createCriteria().andFileLike(tmpPath.replace(File.separator, replacement) + "%"); example.createCriteria().andFileLike(tmpPath.replace(File.separator, replacement) + "%");
main = musicDataDao.selectByExample(example); main = musicDataDao.selectByExample(example);

View File

@ -66,11 +66,11 @@ public class BTDownloadManager implements ApplicationContextAware {
} }
} }
private String getDmhyUrl(BangumiItem item){ private String getDmhyUrl(BangumiItem item){
String dmhyUrl = "http://share.dmhy.org/topics/rss/page/1/rss.xml?keyword=%s%s%s&order=date-desc"; String dmhyUrl = "http://share.dmhy.org/topics/rss/page/1/rss.xml?keyword=%s%s&order=date-desc";
dmhyUrl = String.format(dmhyUrl, dmhyUrl = String.format(dmhyUrl,
item.getTitlekey().replace(" ", "+"), item.getTitlekey().replace(" ", "+"),
"-1".equals(item.getCategories()) ? "" : String.format("&sort_id=%s", item.getCategories()), "-1".equals(item.getCategories()) ? "" : String.format("&sort_id=%s", item.getCategories())
"-1".equals(item.getAuthor()) ? "" : String.format("&team_id=%s", item.getAuthor())); );
return dmhyUrl; return dmhyUrl;
} }
private String getRSSUrl(BangumiItem item) { private String getRSSUrl(BangumiItem item) {