Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Haoyi-Han committed May 5, 2024
2 parents b488b54 + 61f1ac6 commit 47fc1fb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.5
0.5.6
5 changes: 5 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class Application(IRepacker):
repacker: Repacker
parser: ArgumentParser
args: Namespace
pause: bool = False

def __init__(self, verbose: bool = True):
self.pb = generate_progress_bar()
Expand Down Expand Up @@ -158,6 +159,7 @@ def _convert(self):
indent: str = " " * 11
for file_t in self.repacker.faillist:
self.print(f"{indent}{file_t.relative_path}")
self.pause = True

# 键盘Ctrl+C中断命令优化
def keyboard_handler(self, signum, frame):
Expand Down Expand Up @@ -232,6 +234,9 @@ def main(self):

self.log("[green]所有转换任务完成!")

if self.pause:
input("请按任意键继续...")


if __name__ == "__main__":
app = Application()
Expand Down
13 changes: 11 additions & 2 deletions moe_utils/comic_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@

all_volume_pattern: str = r"全[01234567890零一二三四五六七八九十百千萬億万亿壹貳叄肆伍陸柒捌玖拾佰仟贰叁陆]+[卷話冊]"

comic_ns_map = {
'xsd': 'http://www.w3.org/2001/XMLSchema',
'xsi': 'http://www.w3.org/2001/XMLSchema-instance'
}


class MoxBook:
"""
Expand Down Expand Up @@ -72,7 +77,11 @@ def _serial_count(vol: str) -> str:

@staticmethod
def _serial_diff_count(vol: str) -> int:
start, end = vol.replace("話", "").strip().split("-")
matches = re.match(r"話(\d{3})-(\d{3})", vol.strip())
if not matches:
return 1
start = matches.group(1)
end = matches.group(2)
return int(end) - int(start) + 1

@property
Expand Down Expand Up @@ -163,7 +172,7 @@ def to_xml_file(self, output: Path) -> None:
def _build_xml(self, parent: etree._Element, data: dict):
for key, value in data.items():
if isinstance(value, dict):
element = etree.Element(key, attrib=None, nsmap=None)
element = etree.Element(key, attrib=None, nsmap=comic_ns_map)
parent.append(element)
self._build_xml(element, value)
elif isinstance(value, list):
Expand Down

0 comments on commit 47fc1fb

Please sign in to comment.