From 41b645dae3ba3d6fea69d4b7f79da6f8798d9031 Mon Sep 17 00:00:00 2001 From: Izumiko Date: Sun, 16 Jun 2024 00:53:27 +0800 Subject: [PATCH] Add subgroup Regexp --- README.md | 2 ++ package.json | 2 +- server/rss.js | 8 +++++++- src/patterns/Edit.jsx | 9 +++++++++ 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dd5586a..cf84ac3 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,8 @@ $ yarn start 再正确填入其他字段,你就完成了一条抓取模板的编辑。 +> (可选) 类似`(?\d+)`匹配集数的方式,可使用`(?.*?)`匹配字幕组。 + 当然,更方便的方法是找到 Mikan Anime 上对应的 RSS 推送地址,填入 *Remote* 字段后,在侧边栏中选择所需的条目,即可完成前两步操作。 --- diff --git a/package.json b/package.json index a2475b0..a804aaf 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/server/rss.js b/server/rss.js index f9d2879..822ec26 100644 --- a/server/rss.js +++ b/server/rss.js @@ -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], diff --git a/src/patterns/Edit.jsx b/src/patterns/Edit.jsx index c1167a5..43f336e 100644 --- a/src/patterns/Edit.jsx +++ b/src/patterns/Edit.jsx @@ -221,6 +221,15 @@ const PatternInput = () => { > Episode + ), }}