Skip to content

Commit 9935dd2

Browse files
authored
Merge pull request #28 from ThanatosDi/refactor/3.0
重構 3.0 版本
2 parents 30ce6cb + c535351 commit 9935dd2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+2709
-61380
lines changed

.gitignore

+7-1
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,11 @@ venv.bak/
105105
.vscode/settings.json
106106
.modules/*
107107

108+
# custom
108109
*.epub
109-
*.xhtml
110+
*.xhtml
111+
modules.bak/
112+
test.py
113+
OpenCC/
114+
storages/logs/*
115+
!.gitkeep

Pipfile

-19
This file was deleted.

Pipfile.lock

-339
This file was deleted.

README.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
[![GitHub release](https://img.shields.io/github/release/Kutinging/EpubConv_Python.svg?style=plastic)](https://github.com/Kutinging/EpubConv_Python/releases)
22
[![GitHub release](https://img.shields.io/github/v/release/ThanatosDi/EpubConv_Python?include_prereleases&style=plastic)](https://github.com/Kutinging/EpubConv_Python/releases)
3-
[![HitCount](http://hits.dwyl.io/ThanatosDi/EpubConv_Python.svg)](http://hits.dwyl.io/ThanatosDi/EpubConv_Python)
43

54
# EPubConv_Python EPub簡繁橫直互轉 Refactor
65
<!--[![GitHub release](https://img.shields.io/github/release/ThanatosDi/EpubConv_Python.svg?style=plastic)](https://github.com/ThanatosDi/EpubConv_Python/releases) -->
@@ -25,9 +24,9 @@ https://github.com/ThanatosDi/EpubConv_Python/releases
2524
# Notice 注意
2625
本程式使用了繁化姬的 API 服務,如有商業使用([何謂商業使用?](https://docs.zhconvert.org/commercial/#%E4%BD%95%E8%AC%82%E5%95%86%E6%A5%AD%E4%BD%BF%E7%94%A8))請依照繁化姬[說明文件](https://docs.zhconvert.org/commercial/)付費使用
2726

28-
# 贊助我
27+
# Donate 贊助我
2928
只要少喝一杯飲料就可以給我大大的鼓勵
3029
[![QR](https://payment.ecpay.com.tw/Upload/QRCode/201908/QRCode_c3efe2f9-5367-4db4-8440-b6592d9c9e0c.png)](https://p.ecpay.com.tw/7D0E7)
3130

32-
## 感謝贊助 Thank you for Donate
31+
## Thank you for Donate 感謝贊助
3332
* 2019/10/24 蕭先生/小姐

app/Enums/ConverterEnum.py

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
from enum import Enum
2+
3+
4+
class OpenccConverter(Enum):
5+
s2t = 's2t'
6+
s2tw = 's2tw'
7+
s2twp = 's2twp'
8+
t2s = 't2s'
9+
tw2s = 'tw2s'
10+
tw2sp = 'tw2sp'
11+
12+
@classmethod
13+
def has_value(cls, value):
14+
return value in cls._value2member_map_
15+
16+
17+
class FilenameConverter(Enum):
18+
s2t = 's2t'
19+
s2tw = 's2t'
20+
s2twp = 's2t'
21+
t2s = 't2s'
22+
tw2s = 't2s'
23+
tw2sp = 't2s'
24+
25+
26+
class FanhuajiConverter(Enum):
27+
s2t = 'Traditional'
28+
t2s = 'Simplified'
29+
s2tw = 'Traditional'
30+
s2twp = 'Taiwan'
31+
tw2s = 'Simplified'
32+
tw2sp = 'China'
33+
34+
@classmethod
35+
def has_value(cls, value):
36+
return value in cls._value2member_map_
37+
38+
39+
class Converter(Enum):
40+
s2t = 's2t'
41+
s2tw = 's2tw'
42+
s2twp = 's2twp'
43+
t2s = 't2s'
44+
tw2s = 'tw2s'
45+
tw2sp = 'tw2sp'
46+
47+
@classmethod
48+
def has_name(cls, name):
49+
return name in cls._member_names_
50+
51+
52+
class ConverterEnum(Enum):
53+
opencc = OpenccConverter
54+
fanhuaji = FanhuajiConverter
55+
filename = FilenameConverter
56+
converter = Converter

app/Enums/EngineEnum.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from enum import Enum
2+
3+
4+
class EngineEnum(Enum):
5+
fanhuaji = 'fanhuaji'
6+
fanhuaji_async = 'fanhuaji_async'
7+
opencc = 'opencc'
8+
9+
@classmethod
10+
def has_value(cls, value):
11+
return value in cls._value2member_map_

app/Enums/FormatEnum.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from enum import Enum
2+
3+
4+
class FormatEnum(Enum):
5+
vertical = 'vertical' # 直書
6+
horizontal = 'horizontal' # 橫書
7+
8+
@classmethod
9+
def has_value(cls, value):
10+
return value in cls._value2member_map_

app/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__VERSION__ = '3.0.0'
File renamed without changes.

app/engines/engineABC.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import abc
2+
3+
4+
class Engine(abc.ABC):
5+
@abc.abstractmethod
6+
def convert(self, text, **kwargs): ...

0 commit comments

Comments
 (0)