Skip to content

Commit

Permalink
feat: 链接附件时给附件添加个条目标签
Browse files Browse the repository at this point in the history
  • Loading branch information
chivehao committed Oct 19, 2024
1 parent 37bf14c commit 2b26c2d
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 12 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.3

- 链接附件时给附件添加个条目标签

# 17.1.2

- 修复添加标签的问题
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ext {
springContext = '6.0.3'
pf4j = '3.8.0'
lombok = '1.18.24'
libFile = 'lib/api-0.17.0.jar'
libFile = 'lib/api-0.17.4.jar'
}


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.2
version=17.1.3
Binary file not shown.
Binary file renamed lib/api-0.17.0.jar → lib/api-0.17.4.jar
Binary file not shown.
22 changes: 15 additions & 7 deletions src/main/java/run/ikaros/plugin/mikan/MikanSubHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@
import run.ikaros.api.core.attachment.AttachmentReferenceOperate;
import run.ikaros.api.core.subject.Subject;
import run.ikaros.api.core.subject.SubjectOperate;
import run.ikaros.api.core.tag.Tag;
import run.ikaros.api.core.tag.TagOperate;
import run.ikaros.api.infra.properties.IkarosProperties;
import run.ikaros.api.infra.utils.FileUtils;
import run.ikaros.api.store.enums.AttachmentReferenceType;
import run.ikaros.api.store.enums.AttachmentType;
import run.ikaros.api.store.enums.FileType;
import run.ikaros.api.store.enums.SubjectSyncPlatform;
import run.ikaros.api.store.enums.*;
import run.ikaros.plugin.mikan.qbittorrent.QbTorrentInfoFilter;
import run.ikaros.plugin.mikan.qbittorrent.QbittorrentClient;
import run.ikaros.plugin.mikan.qbittorrent.model.QbTorrentInfo;
Expand Down Expand Up @@ -47,18 +46,20 @@ public class MikanSubHandler {
private final SubjectOperate subjectOperate;
private final AttachmentOperate attachmentOperate;
private final AttachmentReferenceOperate attachmentReferenceOperate;
private final TagOperate tagOperate;
private final IkarosProperties ikarosProperties;
private RuntimeMode pluginRuntimeMode;

public MikanSubHandler(MikanClient mikanClient, QbittorrentClient qbittorrentClient,
SubjectOperate subjectOperate, AttachmentOperate attachmentOperate,
AttachmentReferenceOperate attachmentReferenceOperate,
AttachmentReferenceOperate attachmentReferenceOperate, TagOperate tagOperate,
IkarosProperties ikarosProperties) {
this.mikanClient = mikanClient;
this.qbittorrentClient = qbittorrentClient;
this.subjectOperate = subjectOperate;
this.attachmentOperate = attachmentOperate;
this.attachmentReferenceOperate = attachmentReferenceOperate;
this.tagOperate = tagOperate;
this.ikarosProperties = ikarosProperties;
}

Expand Down Expand Up @@ -177,9 +178,16 @@ private Mono<Subject> matchingSingleFile(Subject subject, String fileName, Long
return attachmentOperate.findByTypeAndParentIdAndName(AttachmentType.File, parentId,
fileName)
.map(Attachment::getId)
.flatMap(attId -> attachmentReferenceOperate
.flatMap(attId -> tagOperate.create(Tag.builder()
.createTime(LocalDateTime.now())
.type(TagType.ATTACHMENT)
.masterId(attId)
.name("subject:" + subject.getId())
.userId(-1L)
.build()))
.flatMap(tag -> attachmentReferenceOperate
.matchingAttachmentsAndSubjectEpisodes(
subject.getId(), new Long[]{attId}, true))
subject.getId(), new Long[]{tag.getMasterId()}, true))
.then(Mono.just(subject));
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ 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.1
requires: ">=0.17.0"
version: 17.1.3
requires: ">=0.17.4"
author:
name: Ikaros OSS Team
website: https://github.com/ikaros-dev
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void parseMikanSubRssAndAddToQbittorrent() {
qc.setBaseSavePath("C:\\Users\\chivehao\\Videos\\Tests");
qc.setConfig(config);

MikanSubHandler mikanSubHandler = new MikanSubHandler(mc, qc, null, null, null, null);
MikanSubHandler mikanSubHandler = new MikanSubHandler(mc, qc, null, null, null, null, null);

StepVerifier.create(mikanSubHandler.parseMikanSubRssAndAddToQbittorrent())
.verifyComplete();
Expand Down

0 comments on commit 2b26c2d

Please sign in to comment.