easyrip 4.4.0__tar.gz → 4.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {easyrip-4.4.0 → easyrip-4.5.0}/PKG-INFO +1 -1
- {easyrip-4.4.0 → easyrip-4.5.0}/easyrip/__main__.py +1 -0
- {easyrip-4.4.0 → easyrip-4.5.0}/easyrip/global_val.py +1 -1
- {easyrip-4.4.0 → easyrip-4.5.0}/easyrip/ripper/sub_and_font/font.py +28 -7
- {easyrip-4.4.0 → easyrip-4.5.0}/easyrip/ripper/sub_and_font/subset.py +2 -2
- {easyrip-4.4.0 → easyrip-4.5.0}/easyrip.egg-info/PKG-INFO +1 -1
- {easyrip-4.4.0 → easyrip-4.5.0}/LICENSE +0 -0
- {easyrip-4.4.0 → easyrip-4.5.0}/README.md +0 -0
- {easyrip-4.4.0 → easyrip-4.5.0}/easyrip/__init__.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.0}/easyrip/easyrip_command.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.0}/easyrip/easyrip_config/config.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.0}/easyrip/easyrip_config/config_key.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.0}/easyrip/easyrip_log.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.0}/easyrip/easyrip_main.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.0}/easyrip/easyrip_mlang/__init__.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.0}/easyrip/easyrip_mlang/global_lang_val.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.0}/easyrip/easyrip_mlang/lang_en.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.0}/easyrip/easyrip_mlang/lang_zh_Hans_CN.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.0}/easyrip/easyrip_mlang/translator.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.0}/easyrip/easyrip_prompt.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.0}/easyrip/easyrip_web/__init__.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.0}/easyrip/easyrip_web/http_server.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.0}/easyrip/easyrip_web/third_party_api.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.0}/easyrip/ripper/media_info.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.0}/easyrip/ripper/param.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.0}/easyrip/ripper/ripper.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.0}/easyrip/ripper/sub_and_font/__init__.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.0}/easyrip/ripper/sub_and_font/ass.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.0}/easyrip/utils.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.0}/easyrip.egg-info/SOURCES.txt +0 -0
- {easyrip-4.4.0 → easyrip-4.5.0}/easyrip.egg-info/dependency_links.txt +0 -0
- {easyrip-4.4.0 → easyrip-4.5.0}/easyrip.egg-info/entry_points.txt +0 -0
- {easyrip-4.4.0 → easyrip-4.5.0}/easyrip.egg-info/requires.txt +0 -0
- {easyrip-4.4.0 → easyrip-4.5.0}/easyrip.egg-info/top_level.txt +0 -0
- {easyrip-4.4.0 → easyrip-4.5.0}/pyproject.toml +0 -0
- {easyrip-4.4.0 → easyrip-4.5.0}/setup.cfg +0 -0
|
@@ -3,7 +3,7 @@ import sys
|
|
|
3
3
|
from pathlib import Path
|
|
4
4
|
|
|
5
5
|
PROJECT_NAME = "Easy Rip"
|
|
6
|
-
PROJECT_VERSION = "4.
|
|
6
|
+
PROJECT_VERSION = "4.5.0"
|
|
7
7
|
PROJECT_TITLE = f"{PROJECT_NAME} v{PROJECT_VERSION}"
|
|
8
8
|
PROJECT_URL = "https://github.com/op200/EasyRip"
|
|
9
9
|
PROJECT_RELEASE_API = "https://api.github.com/repos/op200/EasyRip/releases/latest"
|
|
@@ -40,7 +40,13 @@ class Font:
|
|
|
40
40
|
self.font.close()
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
def load_fonts(
|
|
43
|
+
def load_fonts(
|
|
44
|
+
path: str | Path,
|
|
45
|
+
*,
|
|
46
|
+
lazy: bool = True,
|
|
47
|
+
strict: bool = False,
|
|
48
|
+
) -> list[Font]:
|
|
49
|
+
"""strict: Skip UnicodeDecodeError font file"""
|
|
44
50
|
if isinstance(path, str):
|
|
45
51
|
path = Path(path)
|
|
46
52
|
|
|
@@ -59,6 +65,7 @@ def load_fonts(path: str | Path, lazy: bool = True) -> list[Font]:
|
|
|
59
65
|
if suffix == ".ttc"
|
|
60
66
|
else [TTFont(file=file, lazy=lazy)]
|
|
61
67
|
):
|
|
68
|
+
skip_this_font: bool = False
|
|
62
69
|
table_name: table__n_a_m_e | None = font.get("name")
|
|
63
70
|
|
|
64
71
|
if table_name is None:
|
|
@@ -76,7 +83,16 @@ def load_fonts(path: str | Path, lazy: bool = True) -> list[Font]:
|
|
|
76
83
|
if name_id not in {1, 2}:
|
|
77
84
|
continue
|
|
78
85
|
|
|
79
|
-
|
|
86
|
+
try:
|
|
87
|
+
name_str: str = record.toUnicode()
|
|
88
|
+
except UnicodeDecodeError as e:
|
|
89
|
+
error_text = f"Unicode decode error in font \"{file}\": {e}: '{record.toUnicode('replace')}'. Skip this {'font' if strict else 'name record'}."
|
|
90
|
+
if strict:
|
|
91
|
+
log.error(error_text, is_format=False)
|
|
92
|
+
skip_this_font = True
|
|
93
|
+
break
|
|
94
|
+
log.warning(error_text, is_format=False)
|
|
95
|
+
continue
|
|
80
96
|
|
|
81
97
|
match name_id:
|
|
82
98
|
case 1: # Font Family Name
|
|
@@ -94,6 +110,9 @@ def load_fonts(path: str | Path, lazy: bool = True) -> list[Font]:
|
|
|
94
110
|
case "italic" | "oblique":
|
|
95
111
|
is_italic = True
|
|
96
112
|
|
|
113
|
+
if skip_this_font:
|
|
114
|
+
continue
|
|
115
|
+
|
|
97
116
|
if not res_font.familys:
|
|
98
117
|
log.warning(f"Font {file} has no family names. Skip this font")
|
|
99
118
|
continue
|
|
@@ -121,16 +140,18 @@ def load_fonts(path: str | Path, lazy: bool = True) -> list[Font]:
|
|
|
121
140
|
res_font_list.append(res_font)
|
|
122
141
|
|
|
123
142
|
except TTLibError as e:
|
|
124
|
-
log.
|
|
125
|
-
except UnicodeDecodeError as e:
|
|
126
|
-
log.warning(f"Unicode decode error for font {file}: {e}")
|
|
143
|
+
log.error(f'Error loading font file "{file}": {e}')
|
|
127
144
|
except Exception as e:
|
|
128
145
|
log.error(f"Unexpected error for font {file}: {e}")
|
|
129
146
|
|
|
130
147
|
return res_font_list
|
|
131
148
|
|
|
132
149
|
|
|
133
|
-
def load_windows_fonts(
|
|
150
|
+
def load_windows_fonts(
|
|
151
|
+
*,
|
|
152
|
+
lazy: bool = True,
|
|
153
|
+
strict: bool = False,
|
|
154
|
+
) -> list[Font]:
|
|
134
155
|
paths: tuple[str, ...] = (
|
|
135
156
|
os.path.join(os.environ["SYSTEMROOT"], "Fonts"),
|
|
136
157
|
os.path.join(os.environ["LOCALAPPDATA"], "Microsoft/Windows/Fonts"),
|
|
@@ -138,7 +159,7 @@ def load_windows_fonts(lazy: bool = True) -> list[Font]:
|
|
|
138
159
|
|
|
139
160
|
return list(
|
|
140
161
|
itertools.chain.from_iterable(
|
|
141
|
-
load_fonts(path
|
|
162
|
+
load_fonts(path, lazy=lazy, strict=strict) for path in paths
|
|
142
163
|
)
|
|
143
164
|
)
|
|
144
165
|
|
|
@@ -282,9 +282,9 @@ def subset(
|
|
|
282
282
|
# 加载 Font
|
|
283
283
|
fonts: Final[list[Font]] = []
|
|
284
284
|
for _path in font_path_list:
|
|
285
|
-
fonts.extend(load_fonts(_path))
|
|
285
|
+
fonts.extend(load_fonts(_path, strict=strict))
|
|
286
286
|
if use_win_font:
|
|
287
|
-
fonts.extend(load_windows_fonts())
|
|
287
|
+
fonts.extend(load_windows_fonts(strict=strict))
|
|
288
288
|
|
|
289
289
|
font_sign__font: dict[tuple[str, Font_type], Font] = {}
|
|
290
290
|
for _font in fonts:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|