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 75281bb commit 485b750
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 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.6

- 创建条目的时候添加个标签

# 17.1.5

- 移除日志
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.5
version=17.1.6
15 changes: 14 additions & 1 deletion src/main/java/run/ikaros/plugin/mikan/MikanSubHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ public Mono<Void> parseMikanSubRssAndAddToQbittorrent() {
.doOnNext(mikanRssItem ->
log.debug("start for each mikan rss item list for item title: {}",
mikanRssItem.getTitle()))
.parallel()
.flatMap(mikanRssItem -> {
String mikanRssItemTitle = mikanRssItem.getTitle();
qbittorrentClient.addTorrentFromUrl(mikanRssItem.getTorrentUrl(),
Expand Down Expand Up @@ -161,6 +160,7 @@ public Mono<Void> parseMikanSubRssAndAddToQbittorrent() {
return subjectOperate.syncByPlatform(null, SubjectSyncPlatform.BGM_TV,
bgmTvSubjectId);
})
.flatMap(this::saveSubjectFromTag)
.doOnError(throwable -> log.error("parse mikan sub rss item fail.", throwable))
.doOnComplete(() -> {
// 如果新添加的种子文件状态是缺失文件,则需要再恢复下
Expand Down Expand Up @@ -190,6 +190,18 @@ private Mono<Subject> matchingSingleFile(Subject subject, String fileName, Long
.then(Mono.just(subject));
}

private synchronized Mono<Subject> saveSubjectFromTag(Subject subject) {
final String tagName = "from:" + MikanPlugin.NAME;
return tagOperate.create(Tag.builder()
.createTime(LocalDateTime.now())
.type(TagType.SUBJECT)
.masterId(subject.getId())
.name(tagName)
.userId(-1L)
.build())
.map(tag -> subject);
}

public Mono<Void> importQbittorrentFilesAndAddSubject() {
return Mono.just(qbittorrentClient)
.doOnNext(qc ->
Expand All @@ -211,6 +223,7 @@ public Mono<Void> importQbittorrentFilesAndAddSubject() {
.filter(StringUtils::hasText)
.flatMap(bgmTvSubjectId -> subjectOperate.syncByPlatform(null,
SubjectSyncPlatform.BGM_TV, bgmTvSubjectId)
.flatMap(this::saveSubjectFromTag)
.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.5
version: 17.1.6
requires: ">=0.17.4"
author:
name: Ikaros OSS Team
Expand Down

0 comments on commit 485b750

Please sign in to comment.