easyrip 4.8.1__tar.gz → 4.9.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.
Files changed (36) hide show
  1. {easyrip-4.8.1 → easyrip-4.9.0}/PKG-INFO +1 -1
  2. {easyrip-4.8.1 → easyrip-4.9.0}/easyrip/easyrip_mlang/lang_zh_Hans_CN.py +1 -0
  3. {easyrip-4.8.1 → easyrip-4.9.0}/easyrip/global_val.py +1 -1
  4. {easyrip-4.8.1 → easyrip-4.9.0}/easyrip/ripper/sub_and_font/font.py +0 -9
  5. {easyrip-4.8.1 → easyrip-4.9.0}/easyrip/ripper/sub_and_font/subset.py +33 -18
  6. {easyrip-4.8.1 → easyrip-4.9.0}/easyrip.egg-info/PKG-INFO +1 -1
  7. {easyrip-4.8.1 → easyrip-4.9.0}/LICENSE +0 -0
  8. {easyrip-4.8.1 → easyrip-4.9.0}/README.md +0 -0
  9. {easyrip-4.8.1 → easyrip-4.9.0}/easyrip/__init__.py +0 -0
  10. {easyrip-4.8.1 → easyrip-4.9.0}/easyrip/__main__.py +0 -0
  11. {easyrip-4.8.1 → easyrip-4.9.0}/easyrip/easyrip_command.py +0 -0
  12. {easyrip-4.8.1 → easyrip-4.9.0}/easyrip/easyrip_config/config.py +0 -0
  13. {easyrip-4.8.1 → easyrip-4.9.0}/easyrip/easyrip_config/config_key.py +0 -0
  14. {easyrip-4.8.1 → easyrip-4.9.0}/easyrip/easyrip_log.py +0 -0
  15. {easyrip-4.8.1 → easyrip-4.9.0}/easyrip/easyrip_main.py +0 -0
  16. {easyrip-4.8.1 → easyrip-4.9.0}/easyrip/easyrip_mlang/__init__.py +0 -0
  17. {easyrip-4.8.1 → easyrip-4.9.0}/easyrip/easyrip_mlang/global_lang_val.py +0 -0
  18. {easyrip-4.8.1 → easyrip-4.9.0}/easyrip/easyrip_mlang/lang_en.py +0 -0
  19. {easyrip-4.8.1 → easyrip-4.9.0}/easyrip/easyrip_mlang/translator.py +0 -0
  20. {easyrip-4.8.1 → easyrip-4.9.0}/easyrip/easyrip_prompt.py +0 -0
  21. {easyrip-4.8.1 → easyrip-4.9.0}/easyrip/easyrip_web/__init__.py +0 -0
  22. {easyrip-4.8.1 → easyrip-4.9.0}/easyrip/easyrip_web/http_server.py +0 -0
  23. {easyrip-4.8.1 → easyrip-4.9.0}/easyrip/easyrip_web/third_party_api.py +0 -0
  24. {easyrip-4.8.1 → easyrip-4.9.0}/easyrip/ripper/media_info.py +0 -0
  25. {easyrip-4.8.1 → easyrip-4.9.0}/easyrip/ripper/param.py +0 -0
  26. {easyrip-4.8.1 → easyrip-4.9.0}/easyrip/ripper/ripper.py +0 -0
  27. {easyrip-4.8.1 → easyrip-4.9.0}/easyrip/ripper/sub_and_font/__init__.py +0 -0
  28. {easyrip-4.8.1 → easyrip-4.9.0}/easyrip/ripper/sub_and_font/ass.py +0 -0
  29. {easyrip-4.8.1 → easyrip-4.9.0}/easyrip/utils.py +0 -0
  30. {easyrip-4.8.1 → easyrip-4.9.0}/easyrip.egg-info/SOURCES.txt +0 -0
  31. {easyrip-4.8.1 → easyrip-4.9.0}/easyrip.egg-info/dependency_links.txt +0 -0
  32. {easyrip-4.8.1 → easyrip-4.9.0}/easyrip.egg-info/entry_points.txt +0 -0
  33. {easyrip-4.8.1 → easyrip-4.9.0}/easyrip.egg-info/requires.txt +0 -0
  34. {easyrip-4.8.1 → easyrip-4.9.0}/easyrip.egg-info/top_level.txt +0 -0
  35. {easyrip-4.8.1 → easyrip-4.9.0}/pyproject.toml +0 -0
  36. {easyrip-4.8.1 → easyrip-4.9.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: easyrip
3
- Version: 4.8.1
3
+ Version: 4.9.0
4
4
  Author: op200
5
5
  License-Expression: AGPL-3.0-or-later
6
6
  Project-URL: Homepage, https://github.com/op200/EasyRip
@@ -329,6 +329,7 @@ LANG_MAP: dict[str, str] = {
329
329
  "Subset faild, cancel mux": "子集化失败, 取消混流",
330
330
  "FFmpeg report: {}": "FFmpeg 报告: {}",
331
331
  "{} not found. Skip it": "没找到 {}。默认跳过",
332
+ "{} not found. Skip it. Perhaps you want the {}": "没找到 {}。默认跳过。或许你想要的是 {}",
332
333
  'The font "{}" does not contain these characters: {}': '字体 "{}" 不包含字符: {}',
333
334
  "The style '{}' not in Styles. Defaulting to the style '{}'": "样式 '{}' 不在 Styles 中。默认使用样式 '{}'",
334
335
  "The style '{}' and the style 'Default' not in Styles. Defaulting to no font": "样式 '{}' 和样式 'Default' 都不在 Styles 中。默认不使用字体",
@@ -3,7 +3,7 @@ import sys
3
3
  from pathlib import Path
4
4
 
5
5
  PROJECT_NAME = "Easy Rip"
6
- PROJECT_VERSION = "4.8.1"
6
+ PROJECT_VERSION = "4.9.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"
@@ -190,17 +190,8 @@ def subset_font(font: Font, subset_str: str, affix: str) -> tuple[TTFont, bool]:
190
190
 
191
191
  # 创建子集化选项
192
192
  options = subset.Options()
193
- options.drop_tables = ["DSIG", "PCLT", "EBDT", "EBSC"] # 不移除任何可能有用的表
194
193
  options.hinting = True # 保留 hinting
195
194
  options.name_IDs = [] # 不保留 name 表记录
196
- options.no_subset_tables = subset.Options._no_subset_tables_default + [
197
- "BASE",
198
- "mort",
199
- ]
200
- # options.drop_tables = []
201
- options.name_legacy = True
202
- # options.retain_gids = True
203
- options.layout_features = ["*"]
204
195
 
205
196
  # 创建子集化器
206
197
  subsetter = subset.Subsetter(options=options)
@@ -133,6 +133,7 @@ def subset(
133
133
  current_font_sign: tuple[str, Font_type] = default_font_sign
134
134
  for is_tag, text in Event_data.parse_text(event.Text, use_libass_spec):
135
135
  if is_tag:
136
+ tag_fn_org: str | None = None
136
137
  tag_fn: str | None = None
137
138
  tag_bold: str | None = None
138
139
  tag_italic: str | None = None
@@ -151,7 +152,7 @@ def subset(
151
152
 
152
153
  match tag:
153
154
  case "fn":
154
- tag_fn = proc_value
155
+ tag_fn_org, tag_fn = value, proc_value
155
156
  case "b":
156
157
  tag_bold = proc_value
157
158
  case "i":
@@ -183,7 +184,7 @@ def subset(
183
184
 
184
185
  # 修改
185
186
  text = text.replace(
186
- f"\\fn{tag_fn}",
187
+ f"\\fn{tag_fn_org}",
187
188
  f"\\fn{'@' if _is_vertical else ''}{get_font_new_name(new_fontname)}",
188
189
  )
189
190
 
@@ -287,10 +288,11 @@ def subset(
287
288
  fonts.extend(load_windows_fonts(strict=strict))
288
289
 
289
290
  font_sign__font: dict[tuple[str, Font_type], Font] = {}
291
+ family_lower__family = {} # 存储小写 family 用于判断 ASS 的大小写不敏感语法
290
292
  for _font in fonts:
291
293
  for family in _font.familys:
292
- if family not in font_sign__font:
293
- font_sign__font[(family, _font.font_type)] = _font
294
+ family_lower__family[family.lower()] = family
295
+ font_sign__font[(family, _font.font_type)] = _font
294
296
 
295
297
  # 子集化映射
296
298
  font__subset_str: dict[Font, dict[str, str]] = {}
@@ -308,38 +310,51 @@ def subset(
308
310
  case Font_type.Regular:
309
311
  if (
310
312
  (_k := (key[0], Font_type.Bold)) in font_sign__font
311
- or (_k := (key[0], Font_type.Bold_Italic)) in font_sign__font
312
313
  or (_k := (key[0], Font_type.Italic)) in font_sign__font
314
+ or (_k := (key[0], Font_type.Bold_Italic)) in font_sign__font
313
315
  ):
314
316
  _font = font_sign__font[_k]
315
317
 
316
318
  case Font_type.Bold:
317
319
  if (
318
- (_k := (key[0], Font_type.Bold_Italic)) in font_sign__font
319
- or (_k := (key[0], Font_type.Regular)) in font_sign__font
320
+ (_k := (key[0], Font_type.Regular)) in font_sign__font
321
+ or (_k := (key[0], Font_type.Bold_Italic)) in font_sign__font
320
322
  or (_k := (key[0], Font_type.Italic)) in font_sign__font
321
323
  ):
322
324
  _font = font_sign__font[_k]
323
325
 
324
326
  case Font_type.Italic:
325
- if (_k := (key[0], Font_type.Regular)) in font_sign__font or (
326
- _k := (key[0], Font_type.Bold)
327
- ) in font_sign__font:
327
+ if (
328
+ (_k := (key[0], Font_type.Regular)) in font_sign__font
329
+ or (_k := (key[0], Font_type.Bold_Italic)) in font_sign__font
330
+ or (_k := (key[0], Font_type.Bold)) in font_sign__font
331
+ ):
328
332
  _font = font_sign__font[_k]
329
333
 
330
334
  case Font_type.Bold_Italic:
331
- if (_k := (key[0], Font_type.Bold)) in font_sign__font or (
332
- _k := (key[0], Font_type.Regular)
333
- ) in font_sign__font:
335
+ if (
336
+ (_k := (key[0], Font_type.Bold)) in font_sign__font
337
+ or (_k := (key[0], Font_type.Italic)) in font_sign__font
338
+ or (_k := (key[0], Font_type.Regular)) in font_sign__font
339
+ ):
334
340
  _font = font_sign__font[_k]
335
341
 
336
342
  # 模糊字重也找不到字体
337
343
  if _font is None:
338
- log.error(
339
- "{} not found. Skip it",
340
- f"( {key[0]} / {key[1].name} )",
341
- deep=strict,
342
- )
344
+ _want_font_sign_str = f"( {key[0]} / {key[1].name} )"
345
+ if (_f_low := key[0].lower()) in family_lower__family:
346
+ log.error(
347
+ "{} not found. Skip it. Perhaps you want the {}",
348
+ _want_font_sign_str,
349
+ f"'{family_lower__family[_f_low]}'",
350
+ deep=strict,
351
+ )
352
+ else:
353
+ log.error(
354
+ "{} not found. Skip it",
355
+ _want_font_sign_str,
356
+ deep=strict,
357
+ )
343
358
  return_res = False
344
359
  continue
345
360
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: easyrip
3
- Version: 4.8.1
3
+ Version: 4.9.0
4
4
  Author: op200
5
5
  License-Expression: AGPL-3.0-or-later
6
6
  Project-URL: Homepage, https://github.com/op200/EasyRip
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