Skip to content

Commit

Permalink
Add subgroup Regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
Izumiko committed Jun 15, 2024
1 parent bff2347 commit 41b645d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ $ yarn start

再正确填入其他字段,你就完成了一条抓取模板的编辑。

> (可选) 类似`(?<episode>\d+)`匹配集数的方式,可使用`(?<subgroup>.*?)`匹配字幕组。
当然,更方便的方法是找到 Mikan Anime 上对应的 RSS 推送地址,填入 *Remote* 字段后,在侧边栏中选择所需的条目,即可完成前两步操作。

---
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mikanarr",
"version": "1.3.1",
"version": "1.3.2",
"private": "true",
"description": "Mikanarr, bridge between Mikan Anime and Sonarr",
"type": "module",
Expand Down
8 changes: 7 additions & 1 deletion server/rss.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,13 @@ const route = async (req, res) => {
const normalized = `${series} - S${season}E${episodeWithOffset} - ${language} - ${quality}`;
const params = new URLSearchParams();
params.append("url", enclosure[0].$.url);
params.append("name", normalized);
if (match?.groups?.subgroup) {
const { subgroup } = match.groups;
const fullNormalized = `[${subgroup}] ${normalized}`;
params.append("name", fullNormalized);
} else {
params.append("name", normalized);
}
const newUrl = `${torrentProxy}?${params.toString()}`;
items.push({
title: [normalized],
Expand Down
9 changes: 9 additions & 0 deletions src/patterns/Edit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,15 @@ const PatternInput = () => {
>
Episode
</Button>
<Button
color="primary"
onClick={() => {
clipboard.copy("(?<subgroup>.*?)");
notify("SubGroup pattern copied");
}}
>
Group
</Button>
</>
),
}}
Expand Down

0 comments on commit 41b645d

Please sign in to comment.