better issue regex

This commit is contained in:
AJ Slater 2024-02-21 09:37:00 -08:00
parent 55423a9f10
commit 4b1f5fbdb9
2 changed files with 11 additions and 13 deletions

View File

@ -113,9 +113,8 @@ ORIGINAL_FORMAT_SCAN_INFO_SEPARATE_RE = re_compile(
VOLUME_RE = re_compile(r"((?:v(?:ol(?:ume)?)?\.?)\s*(?P<volume>\d+))")
# ISSUE
_ISSUE_NUMBER_RE_EXP = r"(?P<issue>[\w½]+\.?\d*\w*)"
ISSUE_NUMBER_RE = re_compile(r"(\(?#" + _ISSUE_NUMBER_RE_EXP + r"\)?)")
_ISSUE_RE_EXP = r"(?P<issue>[\d½]+\.?\d*\w*)"
_ISSUE_RE_EXP = r"(?P<issue>\w*(½|\d+)[\.\d+]*\w*)"
ISSUE_NUMBER_RE = re_compile(r"(\(?#" + _ISSUE_RE_EXP + r"\)?)")
ISSUE_END_RE = re_compile(r"([\/\s]\(?" + _ISSUE_RE_EXP + r"\)?(\/|$))")
ISSUE_BEGIN_RE = re_compile(r"((^|\/)\(?" + _ISSUE_RE_EXP + r"\)?[\/|\s])")
ISSUE_ANYWHERE_RE = re_compile(r"\b(\(?" + _ISSUE_RE_EXP + r"\)?)\b")

View File

@ -368,6 +368,13 @@ FNS.update(
"issue": "1024",
"series": "action comics",
},
# This is a contrived test case. I've never seen this I just wanted to handle it with my parser
"Cory Doctorow's Futuristic Tales of the Here and Now #0.0.1 (2007).cbz": {
"ext": "cbz",
"issue": "0.0.1",
"series": "Cory Doctorow's Futuristic Tales of the Here and Now",
"year": "2007",
},
}
)
DIFFICULT = {
@ -431,18 +438,10 @@ DIFFICULT = {
"title": "Anda's Game",
"year": "2007",
},
# This is a contrived test case. I've never seen this I just wanted to handle it with my parser
"Cory Doctorow's Futuristic Tales of the Here and Now #0.0.1 (2007).cbz": {
"ext": "cbz",
"issue": "0.1",
"series": "Cory Doctorow's Futuristic Tales of the Here and Now",
"year": "2007",
"issue_count": "",
},
}
# FNS.update(LATER)
# first_key, first_val = DIFFICULT.popitem()
# FNS[first_key] = first_val
WONFIX = {
# Leading issue number is usually an alternate sequence number