easyrip 4.6.0__tar.gz → 4.6.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.6.0 → easyrip-4.6.1}/PKG-INFO +1 -1
- {easyrip-4.6.0 → easyrip-4.6.1}/easyrip/easyrip_main.py +0 -1
- {easyrip-4.6.0 → easyrip-4.6.1}/easyrip/global_val.py +1 -1
- {easyrip-4.6.0 → easyrip-4.6.1}/easyrip/ripper/sub_and_font/font.py +5 -5
- {easyrip-4.6.0 → easyrip-4.6.1}/easyrip/utils.py +14 -14
- {easyrip-4.6.0 → easyrip-4.6.1}/easyrip.egg-info/PKG-INFO +1 -1
- {easyrip-4.6.0 → easyrip-4.6.1}/LICENSE +0 -0
- {easyrip-4.6.0 → easyrip-4.6.1}/README.md +0 -0
- {easyrip-4.6.0 → easyrip-4.6.1}/easyrip/__init__.py +0 -0
- {easyrip-4.6.0 → easyrip-4.6.1}/easyrip/__main__.py +0 -0
- {easyrip-4.6.0 → easyrip-4.6.1}/easyrip/easyrip_command.py +0 -0
- {easyrip-4.6.0 → easyrip-4.6.1}/easyrip/easyrip_config/config.py +0 -0
- {easyrip-4.6.0 → easyrip-4.6.1}/easyrip/easyrip_config/config_key.py +0 -0
- {easyrip-4.6.0 → easyrip-4.6.1}/easyrip/easyrip_log.py +0 -0
- {easyrip-4.6.0 → easyrip-4.6.1}/easyrip/easyrip_mlang/__init__.py +0 -0
- {easyrip-4.6.0 → easyrip-4.6.1}/easyrip/easyrip_mlang/global_lang_val.py +0 -0
- {easyrip-4.6.0 → easyrip-4.6.1}/easyrip/easyrip_mlang/lang_en.py +0 -0
- {easyrip-4.6.0 → easyrip-4.6.1}/easyrip/easyrip_mlang/lang_zh_Hans_CN.py +0 -0
- {easyrip-4.6.0 → easyrip-4.6.1}/easyrip/easyrip_mlang/translator.py +0 -0
- {easyrip-4.6.0 → easyrip-4.6.1}/easyrip/easyrip_prompt.py +0 -0
- {easyrip-4.6.0 → easyrip-4.6.1}/easyrip/easyrip_web/__init__.py +0 -0
- {easyrip-4.6.0 → easyrip-4.6.1}/easyrip/easyrip_web/http_server.py +0 -0
- {easyrip-4.6.0 → easyrip-4.6.1}/easyrip/easyrip_web/third_party_api.py +0 -0
- {easyrip-4.6.0 → easyrip-4.6.1}/easyrip/ripper/media_info.py +0 -0
- {easyrip-4.6.0 → easyrip-4.6.1}/easyrip/ripper/param.py +0 -0
- {easyrip-4.6.0 → easyrip-4.6.1}/easyrip/ripper/ripper.py +0 -0
- {easyrip-4.6.0 → easyrip-4.6.1}/easyrip/ripper/sub_and_font/__init__.py +0 -0
- {easyrip-4.6.0 → easyrip-4.6.1}/easyrip/ripper/sub_and_font/ass.py +0 -0
- {easyrip-4.6.0 → easyrip-4.6.1}/easyrip/ripper/sub_and_font/subset.py +0 -0
- {easyrip-4.6.0 → easyrip-4.6.1}/easyrip.egg-info/SOURCES.txt +0 -0
- {easyrip-4.6.0 → easyrip-4.6.1}/easyrip.egg-info/dependency_links.txt +0 -0
- {easyrip-4.6.0 → easyrip-4.6.1}/easyrip.egg-info/entry_points.txt +0 -0
- {easyrip-4.6.0 → easyrip-4.6.1}/easyrip.egg-info/requires.txt +0 -0
- {easyrip-4.6.0 → easyrip-4.6.1}/easyrip.egg-info/top_level.txt +0 -0
- {easyrip-4.6.0 → easyrip-4.6.1}/pyproject.toml +0 -0
- {easyrip-4.6.0 → easyrip-4.6.1}/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.
|
|
6
|
+
PROJECT_VERSION = "4.6.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"
|
|
@@ -55,7 +55,7 @@ def load_fonts(
|
|
|
55
55
|
for file in path.iterdir() if path.is_dir() else (path,):
|
|
56
56
|
if not (
|
|
57
57
|
file.is_file()
|
|
58
|
-
and (
|
|
58
|
+
and (suffix := file.suffix.lower()) in {".ttf", ".otf", ".ttc"}
|
|
59
59
|
):
|
|
60
60
|
continue
|
|
61
61
|
|
|
@@ -120,7 +120,7 @@ def load_fonts(
|
|
|
120
120
|
if is_regular:
|
|
121
121
|
if is_bold or is_italic:
|
|
122
122
|
log.error(
|
|
123
|
-
|
|
123
|
+
'Font "{}" is Regular but Bold={} and Italic={}. Skip this font',
|
|
124
124
|
file,
|
|
125
125
|
is_bold,
|
|
126
126
|
is_italic,
|
|
@@ -134,15 +134,15 @@ def load_fonts(
|
|
|
134
134
|
else:
|
|
135
135
|
res_font.font_type = Font_type.Regular
|
|
136
136
|
log.warning(
|
|
137
|
-
f
|
|
137
|
+
f'Font "{file}" does not have an English subfamily name. Defaulting to Regular'
|
|
138
138
|
)
|
|
139
139
|
|
|
140
140
|
res_font_list.append(res_font)
|
|
141
141
|
|
|
142
142
|
except TTLibError as e:
|
|
143
|
-
log.error(f'
|
|
143
|
+
log.error(f'Failed to load font file "{file}": {e}')
|
|
144
144
|
except Exception as e:
|
|
145
|
-
log.error(f
|
|
145
|
+
log.error(f'Unexpected error when load font "{file}": {e}')
|
|
146
146
|
|
|
147
147
|
return res_font_list
|
|
148
148
|
|
|
@@ -7,7 +7,7 @@ import sys
|
|
|
7
7
|
import time
|
|
8
8
|
from itertools import zip_longest
|
|
9
9
|
from pathlib import Path
|
|
10
|
-
from typing import Final, get_args, get_origin
|
|
10
|
+
from typing import Any, Final, TypeGuard, get_args, get_origin
|
|
11
11
|
|
|
12
12
|
from Crypto.Cipher import AES as CryptoAES
|
|
13
13
|
from Crypto.Util.Padding import pad, unpad
|
|
@@ -209,7 +209,7 @@ def non_ascii_str_len(s: str) -> int:
|
|
|
209
209
|
return sum(2 - int(ord(c) < 256) for c in s)
|
|
210
210
|
|
|
211
211
|
|
|
212
|
-
def type_match(val,
|
|
212
|
+
def type_match[T](val: Any, t: type[T]) -> TypeGuard[T]:
|
|
213
213
|
"""
|
|
214
214
|
检查值是否匹配给定的类型(支持泛型)
|
|
215
215
|
|
|
@@ -222,35 +222,35 @@ def type_match(val, b: type) -> bool:
|
|
|
222
222
|
|
|
223
223
|
Args:
|
|
224
224
|
val: 要检查的值
|
|
225
|
-
|
|
225
|
+
t: 目标类型,可以是普通类型或泛型
|
|
226
226
|
|
|
227
227
|
Returns:
|
|
228
228
|
bool: 值是否匹配目标类型
|
|
229
229
|
|
|
230
230
|
"""
|
|
231
|
-
|
|
231
|
+
t_org = get_origin(t)
|
|
232
232
|
|
|
233
233
|
# 如果不是泛型类型,直接使用 isinstance
|
|
234
|
-
if
|
|
235
|
-
return isinstance(val,
|
|
234
|
+
if t_org is None:
|
|
235
|
+
return isinstance(val, t)
|
|
236
236
|
|
|
237
237
|
# 首先检查是否是 b_org 的实例
|
|
238
|
-
if not isinstance(val,
|
|
238
|
+
if not isinstance(val, t_org):
|
|
239
239
|
return False
|
|
240
240
|
|
|
241
241
|
# 获取类型参数
|
|
242
|
-
args = get_args(
|
|
242
|
+
args = get_args(t)
|
|
243
243
|
if not args: # 没有类型参数,如 List
|
|
244
244
|
return True
|
|
245
245
|
|
|
246
246
|
# 根据不同的原始类型进行检查
|
|
247
|
-
if
|
|
247
|
+
if t_org is list:
|
|
248
248
|
# list[T] 检查
|
|
249
249
|
if len(args) == 1:
|
|
250
250
|
elem_type = args[0]
|
|
251
251
|
return all(type_match(item, elem_type) for item in val)
|
|
252
252
|
|
|
253
|
-
elif
|
|
253
|
+
elif t_org is tuple:
|
|
254
254
|
# tuple[T1, T2, ...] 或 tuple[T, ...] 检查
|
|
255
255
|
if len(args) == 2 and args[1] is ...: # 可变长度元组
|
|
256
256
|
elem_type = args[0]
|
|
@@ -260,7 +260,7 @@ def type_match(val, b: type) -> bool:
|
|
|
260
260
|
return False
|
|
261
261
|
return all(type_match(item, t) for item, t in zip(val, args, strict=False))
|
|
262
262
|
|
|
263
|
-
elif
|
|
263
|
+
elif t_org is dict:
|
|
264
264
|
# dict[K, V] 检查
|
|
265
265
|
if len(args) == 2:
|
|
266
266
|
key_type, value_type = args
|
|
@@ -269,19 +269,19 @@ def type_match(val, b: type) -> bool:
|
|
|
269
269
|
for k, v in val.items()
|
|
270
270
|
)
|
|
271
271
|
|
|
272
|
-
elif
|
|
272
|
+
elif t_org is set:
|
|
273
273
|
# set[T] 检查
|
|
274
274
|
if len(args) == 1:
|
|
275
275
|
elem_type = args[0]
|
|
276
276
|
return all(type_match(item, elem_type) for item in val)
|
|
277
277
|
|
|
278
|
-
elif
|
|
278
|
+
elif t_org is frozenset:
|
|
279
279
|
# frozenset[T] 检查
|
|
280
280
|
if len(args) == 1:
|
|
281
281
|
elem_type = args[0]
|
|
282
282
|
return all(type_match(item, elem_type) for item in val)
|
|
283
283
|
|
|
284
|
-
elif hasattr(
|
|
284
|
+
elif hasattr(t_org, "__name__") and t_org.__name__ == "Union":
|
|
285
285
|
# Union[T1, T2, ...] 或 T1 | T2 检查
|
|
286
286
|
return any(type_match(val, t) for t in args)
|
|
287
287
|
|
|
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
|