Skip to content

Commit

Permalink
硬链接目录时不请求从第三方拉取条目
Browse files Browse the repository at this point in the history
  • Loading branch information
chivehao committed Oct 19, 2024
1 parent c9c214e commit 4c8f7f0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

# 17.1.8

- 硬链接目录时不请求从第三方拉取条目

# 17.1.7

- 请求条目同步前进行查询
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
group=run.ikaros.plugin
description=A mikan plugin for ikaros.
version=17.1.7
version=17.1.8
16 changes: 10 additions & 6 deletions src/main/java/run/ikaros/plugin/mikan/MikanSubHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ public Mono<Void> parseMikanSubRssAndAddToQbittorrent() {
}
return syncSubject(bgmTvSubjectId);
})
.flatMap(this::saveSubjectFromTag)
.doOnError(throwable -> log.error("parse mikan sub rss item fail.", throwable))
.doOnComplete(() -> {
// 如果新添加的种子文件状态是缺失文件,则需要再恢复下
Expand Down Expand Up @@ -207,13 +206,19 @@ private synchronized Mono<Subject> saveSubjectFromTag(Subject subject) {
.map(tag -> subject);
}

private synchronized Mono<Subject> syncSubject(String bgmTvSubjectId) {
private Mono<Subject> getSubjectWithBgmTvId(String bgmTvSubjectId) {
AssertUtils.notBlank(bgmTvSubjectId, "'bgmTvSubjectId' must not be blank.");
return syncPlatformOperate.findSubjectSyncBySubjectIdAndPlatform(
Long.parseLong(bgmTvSubjectId), SubjectSyncPlatform.BGM_TV)
.map(SubjectSync::getSubjectId)
.flatMap(subjectOperate::findById)
.switchIfEmpty(subjectOperate.syncByPlatform(null, SubjectSyncPlatform.BGM_TV, bgmTvSubjectId));
.flatMap(subjectOperate::findById);
}

private synchronized Mono<Subject> syncSubject(String bgmTvSubjectId) {
AssertUtils.notBlank(bgmTvSubjectId, "'bgmTvSubjectId' must not be blank.");
return getSubjectWithBgmTvId(bgmTvSubjectId)
.switchIfEmpty(subjectOperate.syncByPlatform(null, SubjectSyncPlatform.BGM_TV, bgmTvSubjectId))
.flatMap(this::saveSubjectFromTag);
}

public Mono<Void> importQbittorrentFilesAndAddSubject() {
Expand All @@ -235,8 +240,7 @@ public Mono<Void> importQbittorrentFilesAndAddSubject() {
.flatMap(torrentInfo -> Mono.just(
torrentInfo.getTags())
.filter(StringUtils::hasText)
.flatMap(bgmTvSubjectId -> syncSubject(bgmTvSubjectId)
.flatMap(this::saveSubjectFromTag)
.flatMap(bgmTvSubjectId -> getSubjectWithBgmTvId(bgmTvSubjectId)
.flatMap(subject -> {
String contentPath = torrentInfo.getContentPath();
File torrentFile = new File(contentPath);
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: PluginMikan
# plugin entry class that extends BasePlugin
clazz: run.ikaros.plugin.mikan.MikanPlugin
# plugin 'version' is a valid semantic version string (see semver.org).
version: 17.1.7
version: 17.1.8
requires: ">=0.17.4"
author:
name: Ikaros OSS Team
Expand Down

0 comments on commit 4c8f7f0

Please sign in to comment.