Skip to content

Commit

Permalink
增加对 EP E 的识别
Browse files Browse the repository at this point in the history
  • Loading branch information
EstrellaXD committed May 3, 2023
1 parent 1e8a025 commit 20ca722
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/module/parser/analyser/raw_parser.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import logging
import re
from dataclasses import dataclass

from module.models import Episode

logger = logging.getLogger(__name__)

EPISODE_RE = re.compile(r"\d+")
TITLE_RE = re.compile(
r"(.*|\[.*])( -? \d+|\[\d+]|\[\d+.?[vV]\d{1}]|[第]?\d+[话話集]|\[\d+.?END])(.*)"
r"(.*|\[.*])( -? \d+|\[\d+]|\[\d+.?[vV]\d]|[ 第]?\d+[话話集]|\[\d+.?END]|[Ee][Pp]?\d+)(.*)"
)
RESOLUTION_RE = re.compile(r"1080|720|2160|4K")
SOURCE_RE = re.compile(r"B-Global|[Bb]aha|[Bb]ilibili|AT-X|Web")
Expand Down Expand Up @@ -81,7 +80,7 @@ def name_process(name: str):
name_en, name_zh, name_jp = None, None, None
name = name.strip()
name = re.sub(r"[((]仅限港澳台地区[))]", "", name)
split = re.split("/|\s{2}|-\s{2}", name)
split = re.split(r"/|\s{2}|-\s{2}", name)
while "" in split:
split.remove("")
if len(split) == 1:
Expand Down
9 changes: 8 additions & 1 deletion src/test/test_rss_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,11 @@ def test_rss_analyser():

assert data.title_raw == "Yamada-kun to Lv999 no Koi wo Suru"
assert data.official_title == "和山田谈场 Lv999 的恋爱"
assert data.season == 1
assert data.season == 1

url = "http://dmhy.org/topics/rss/rss.xml?keyword=假面骑士+Geats&sort_id=0&team_id=648&order=date-desc"
data = rss_analyser.rss_to_data(url=url)

assert data.title_raw == "假面骑士Geats"
assert data.official_title == "假面骑士Geats"
assert data.season == 1

0 comments on commit 20ca722

Please sign in to comment.