easyrip 4.4.0__tar.gz → 4.5.1__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.1}/PKG-INFO +1 -1
- {easyrip-4.4.0 → easyrip-4.5.1}/easyrip/__main__.py +6 -2
- {easyrip-4.4.0 → easyrip-4.5.1}/easyrip/easyrip_command.py +1 -1
- {easyrip-4.4.0 → easyrip-4.5.1}/easyrip/easyrip_mlang/lang_zh_Hans_CN.py +5 -18
- {easyrip-4.4.0 → easyrip-4.5.1}/easyrip/global_val.py +1 -1
- {easyrip-4.4.0 → easyrip-4.5.1}/easyrip/ripper/sub_and_font/font.py +28 -7
- {easyrip-4.4.0 → easyrip-4.5.1}/easyrip/ripper/sub_and_font/subset.py +2 -2
- {easyrip-4.4.0 → easyrip-4.5.1}/easyrip.egg-info/PKG-INFO +1 -1
- {easyrip-4.4.0 → easyrip-4.5.1}/LICENSE +0 -0
- {easyrip-4.4.0 → easyrip-4.5.1}/README.md +0 -0
- {easyrip-4.4.0 → easyrip-4.5.1}/easyrip/__init__.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.1}/easyrip/easyrip_config/config.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.1}/easyrip/easyrip_config/config_key.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.1}/easyrip/easyrip_log.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.1}/easyrip/easyrip_main.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.1}/easyrip/easyrip_mlang/__init__.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.1}/easyrip/easyrip_mlang/global_lang_val.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.1}/easyrip/easyrip_mlang/lang_en.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.1}/easyrip/easyrip_mlang/translator.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.1}/easyrip/easyrip_prompt.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.1}/easyrip/easyrip_web/__init__.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.1}/easyrip/easyrip_web/http_server.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.1}/easyrip/easyrip_web/third_party_api.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.1}/easyrip/ripper/media_info.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.1}/easyrip/ripper/param.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.1}/easyrip/ripper/ripper.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.1}/easyrip/ripper/sub_and_font/__init__.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.1}/easyrip/ripper/sub_and_font/ass.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.1}/easyrip/utils.py +0 -0
- {easyrip-4.4.0 → easyrip-4.5.1}/easyrip.egg-info/SOURCES.txt +0 -0
- {easyrip-4.4.0 → easyrip-4.5.1}/easyrip.egg-info/dependency_links.txt +0 -0
- {easyrip-4.4.0 → easyrip-4.5.1}/easyrip.egg-info/entry_points.txt +0 -0
- {easyrip-4.4.0 → easyrip-4.5.1}/easyrip.egg-info/requires.txt +0 -0
- {easyrip-4.4.0 → easyrip-4.5.1}/easyrip.egg-info/top_level.txt +0 -0
- {easyrip-4.4.0 → easyrip-4.5.1}/pyproject.toml +0 -0
- {easyrip-4.4.0 → easyrip-4.5.1}/setup.cfg +0 -0
|
@@ -64,6 +64,7 @@ def run() -> NoReturn:
|
|
|
64
64
|
in {
|
|
65
65
|
*Cmd_type.cd.value.names,
|
|
66
66
|
*Cmd_type.mediainfo.value.names,
|
|
67
|
+
*Cmd_type.fontinfo.value.names,
|
|
67
68
|
}
|
|
68
69
|
else ()
|
|
69
70
|
),
|
|
@@ -128,8 +129,11 @@ def run() -> NoReturn:
|
|
|
128
129
|
log.debug("Manually force exit")
|
|
129
130
|
sys.exit(0)
|
|
130
131
|
|
|
131
|
-
|
|
132
|
-
|
|
132
|
+
try:
|
|
133
|
+
if not run_command(command):
|
|
134
|
+
log.warning("Stop run command")
|
|
135
|
+
except KeyboardInterrupt:
|
|
136
|
+
log.warning("Manually stop run command")
|
|
133
137
|
|
|
134
138
|
|
|
135
139
|
if __name__ == "__main__":
|
|
@@ -490,7 +490,7 @@ class Opt_type(enum.Enum):
|
|
|
490
490
|
"Audio encoder:\n" # .
|
|
491
491
|
f"{Audio_codec.to_help_string(' ')}"
|
|
492
492
|
),
|
|
493
|
-
childs=(Cmd_type_val((
|
|
493
|
+
childs=(Cmd_type_val(tuple(Audio_codec._value2member_map_)),),
|
|
494
494
|
)
|
|
495
495
|
_b_a = Cmd_type_val(
|
|
496
496
|
("-b:a",),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from ..easyrip_command import Cmd_type, Opt_type
|
|
1
|
+
from ..easyrip_command import Audio_codec, Cmd_type, Opt_type, Preset_name
|
|
2
2
|
from .global_lang_val import (
|
|
3
3
|
Lang_tag,
|
|
4
4
|
Lang_tag_language,
|
|
@@ -135,18 +135,8 @@ LANG_MAP: dict[str, str] = {
|
|
|
135
135
|
),
|
|
136
136
|
Opt_type._preset.value.description: (
|
|
137
137
|
"设置预设\n"
|
|
138
|
-
"预设名:\n"
|
|
139
|
-
"
|
|
140
|
-
" subset\n"
|
|
141
|
-
" copy\n"
|
|
142
|
-
" flac\n"
|
|
143
|
-
" x264fast x264slow\n"
|
|
144
|
-
" x265fast4 x265fast3 x265fast2 x265fast x265slow x265full\n"
|
|
145
|
-
" svtav1\n"
|
|
146
|
-
" vvenc\n"
|
|
147
|
-
" h264_amf h264_nvenc h264_qsv\n"
|
|
148
|
-
" hevc_amf hevc_nvenc hevc_qsv\n"
|
|
149
|
-
" av1_amf av1_nvenc av1_qsv"
|
|
138
|
+
"预设名:\n" # .
|
|
139
|
+
f"{Preset_name.to_help_string(' ')}"
|
|
150
140
|
),
|
|
151
141
|
Opt_type._pipe.value.description: (
|
|
152
142
|
"选择一个 vpy 文件作为管道的输入, 这个 vpy 必须有 input 全局变量\n"
|
|
@@ -209,11 +199,8 @@ LANG_MAP: dict[str, str] = {
|
|
|
209
199
|
),
|
|
210
200
|
Opt_type._c_a.value.description: (
|
|
211
201
|
"设置音频编码器\n"
|
|
212
|
-
"
|
|
213
|
-
"
|
|
214
|
-
" copy\n"
|
|
215
|
-
" libopus\n"
|
|
216
|
-
" flac"
|
|
202
|
+
"音频编码器:\n" # .
|
|
203
|
+
f"{Audio_codec.to_help_string(' ')}"
|
|
217
204
|
),
|
|
218
205
|
Opt_type._b_a.value.description: "设置音频码率。默认值 '160k'",
|
|
219
206
|
Opt_type._muxer.value.description: (
|
|
@@ -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.1"
|
|
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
|