easyrip 4.11.1__tar.gz → 4.11.2__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.11.1 → easyrip-4.11.2}/PKG-INFO +1 -1
  2. {easyrip-4.11.1 → easyrip-4.11.2}/easyrip/easyrip_command.py +16 -1
  3. {easyrip-4.11.1 → easyrip-4.11.2}/easyrip/easyrip_mlang/translator.py +9 -9
  4. {easyrip-4.11.1 → easyrip-4.11.2}/easyrip/global_val.py +1 -1
  5. {easyrip-4.11.1 → easyrip-4.11.2}/easyrip/ripper/param.py +1 -1
  6. {easyrip-4.11.1 → easyrip-4.11.2}/easyrip/ripper/ripper.py +41 -38
  7. {easyrip-4.11.1 → easyrip-4.11.2}/easyrip.egg-info/PKG-INFO +1 -1
  8. {easyrip-4.11.1 → easyrip-4.11.2}/LICENSE +0 -0
  9. {easyrip-4.11.1 → easyrip-4.11.2}/README.md +0 -0
  10. {easyrip-4.11.1 → easyrip-4.11.2}/easyrip/__init__.py +0 -0
  11. {easyrip-4.11.1 → easyrip-4.11.2}/easyrip/__main__.py +0 -0
  12. {easyrip-4.11.1 → easyrip-4.11.2}/easyrip/easyrip_config/config.py +0 -0
  13. {easyrip-4.11.1 → easyrip-4.11.2}/easyrip/easyrip_config/config_key.py +0 -0
  14. {easyrip-4.11.1 → easyrip-4.11.2}/easyrip/easyrip_log.py +0 -0
  15. {easyrip-4.11.1 → easyrip-4.11.2}/easyrip/easyrip_main.py +0 -0
  16. {easyrip-4.11.1 → easyrip-4.11.2}/easyrip/easyrip_mlang/__init__.py +0 -0
  17. {easyrip-4.11.1 → easyrip-4.11.2}/easyrip/easyrip_mlang/global_lang_val.py +0 -0
  18. {easyrip-4.11.1 → easyrip-4.11.2}/easyrip/easyrip_mlang/lang_en.py +0 -0
  19. {easyrip-4.11.1 → easyrip-4.11.2}/easyrip/easyrip_mlang/lang_zh_Hans_CN.py +0 -0
  20. {easyrip-4.11.1 → easyrip-4.11.2}/easyrip/easyrip_prompt.py +0 -0
  21. {easyrip-4.11.1 → easyrip-4.11.2}/easyrip/easyrip_web/__init__.py +0 -0
  22. {easyrip-4.11.1 → easyrip-4.11.2}/easyrip/easyrip_web/http_server.py +0 -0
  23. {easyrip-4.11.1 → easyrip-4.11.2}/easyrip/easyrip_web/third_party_api.py +0 -0
  24. {easyrip-4.11.1 → easyrip-4.11.2}/easyrip/ripper/media_info.py +0 -0
  25. {easyrip-4.11.1 → easyrip-4.11.2}/easyrip/ripper/sub_and_font/__init__.py +0 -0
  26. {easyrip-4.11.1 → easyrip-4.11.2}/easyrip/ripper/sub_and_font/ass.py +0 -0
  27. {easyrip-4.11.1 → easyrip-4.11.2}/easyrip/ripper/sub_and_font/font.py +0 -0
  28. {easyrip-4.11.1 → easyrip-4.11.2}/easyrip/ripper/sub_and_font/subset.py +0 -0
  29. {easyrip-4.11.1 → easyrip-4.11.2}/easyrip/utils.py +0 -0
  30. {easyrip-4.11.1 → easyrip-4.11.2}/easyrip.egg-info/SOURCES.txt +0 -0
  31. {easyrip-4.11.1 → easyrip-4.11.2}/easyrip.egg-info/dependency_links.txt +0 -0
  32. {easyrip-4.11.1 → easyrip-4.11.2}/easyrip.egg-info/entry_points.txt +0 -0
  33. {easyrip-4.11.1 → easyrip-4.11.2}/easyrip.egg-info/requires.txt +0 -0
  34. {easyrip-4.11.1 → easyrip-4.11.2}/easyrip.egg-info/top_level.txt +0 -0
  35. {easyrip-4.11.1 → easyrip-4.11.2}/pyproject.toml +0 -0
  36. {easyrip-4.11.1 → easyrip-4.11.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: easyrip
3
- Version: 4.11.1
3
+ Version: 4.11.2
4
4
  Author: op200
5
5
  License-Expression: AGPL-3.0-or-later
6
6
  Project-URL: Homepage, https://github.com/op200/EasyRip
@@ -595,6 +595,21 @@ class Opt_type(enum.Enum):
595
595
  ("-hwaccel",),
596
596
  param="<string>",
597
597
  description="Use FFmpeg hwaccel (See 'ffmpeg -hwaccels' for details)",
598
+ childs=(
599
+ Cmd_type_val(
600
+ names=(
601
+ "cuda",
602
+ "vaapi",
603
+ "dxva2",
604
+ "qsv",
605
+ "d3d11va",
606
+ "opencl",
607
+ "vulkan",
608
+ "d3d12va",
609
+ "amf",
610
+ )
611
+ ),
612
+ ),
598
613
  )
599
614
  _ss = Cmd_type_val(
600
615
  ("-ss",),
@@ -793,7 +808,7 @@ class OptCompleter(Completer):
793
808
 
794
809
  if (
795
810
  (opt_tree_pos_list[-1] is not self.opt_tree)
796
- or (words[-1] in add_comp_words)
811
+ or (words and words[-1] in add_comp_words)
797
812
  ) and not text.endswith(" "):
798
813
  # 不在根(上个单词没让这个单词回退到根) or 匹配额外提示
799
814
  # 且尾部不是空格
@@ -42,20 +42,20 @@ def translate_subtitles(
42
42
 
43
43
  file_list: Final[list[tuple[Path, str]]] = []
44
44
  for f in directory.iterdir():
45
- if f.suffix not in {".ass", ".ssa", ".srt"} or (
46
- file_intersection_selector is not None
47
- and f not in file_intersection_selector
45
+ if (
46
+ not f.is_file()
47
+ or f.suffix not in {".ass", ".ssa", ".srt"}
48
+ or (
49
+ file_intersection_selector is not None
50
+ and not all(map(f.samefile, file_intersection_selector))
51
+ )
48
52
  ):
49
53
  continue
50
54
 
51
- if len(_stems := f.stem.split(".")) < 1:
52
- continue
53
- if infix == _stems[-1]:
55
+ if (_stems := f.stem.split(".")) and (infix == _stems[-1]):
54
56
  file_list.append(
55
57
  (
56
- f.with_name(
57
- f"{'.'.join(f.stem.split('.')[:-1])}.{target_lang_tag}{f.suffix}"
58
- ),
58
+ f.with_name(f"{'.'.join(_stems[:-1])}.{target_lang_tag}{f.suffix}"),
59
59
  read_text(f),
60
60
  )
61
61
  )
@@ -4,7 +4,7 @@ from functools import cache
4
4
  from pathlib import Path
5
5
 
6
6
  PROJECT_NAME = "Easy Rip"
7
- PROJECT_VERSION = "4.11.1"
7
+ PROJECT_VERSION = "4.11.2"
8
8
  PROJECT_TITLE = f"{PROJECT_NAME} v{PROJECT_VERSION}"
9
9
  PROJECT_URL = "https://github.com/op200/EasyRip"
10
10
  PROJECT_RELEASE_API = "https://api.github.com/repos/op200/EasyRip/releases/latest"
@@ -434,7 +434,7 @@ DEFAULT_PRESET_PARAMS: Final[dict[Preset_name, dict[LiteralString, LiteralString
434
434
  {
435
435
  "crf": "17",
436
436
  "qpmin": "3",
437
- "qpmax": "21.5",
437
+ "qpmax": "23",
438
438
  "psy-rd": "2.2",
439
439
  "rd": "5",
440
440
  "rdoq-level": "2",
@@ -802,11 +802,42 @@ class Ripper:
802
802
  )
803
803
 
804
804
  case Ripper.Preset_name.subset:
805
+ # 临时翻译
806
+ add_tr_file_list: Final[list[Path]] = []
807
+ if translate_sub := self.option_map.get("translate-sub"):
808
+ _tr = translate_sub.split(":")
809
+ if len(_tr) != 2:
810
+ log.error("{} param illegal", "-translate-sub")
811
+ else:
812
+ try:
813
+ _file_list = translate_subtitles(
814
+ Path(self.output_dir),
815
+ _tr[0],
816
+ _tr[1],
817
+ file_intersection_selector=self.input_path_list,
818
+ )
819
+ except Exception as e:
820
+ log.error(e, is_format=False)
821
+ else:
822
+ for f_and_s in _file_list:
823
+ if f_and_s[0].is_file():
824
+ log.warning(
825
+ 'The file "{}" already exists, skip translating it',
826
+ f_and_s[0],
827
+ )
828
+ continue
829
+
830
+ with f_and_s[0].open(
831
+ "wt", encoding="utf-8-sig", newline="\n"
832
+ ) as f:
833
+ f.write(f_and_s[1])
834
+ add_tr_file_list.append(f_and_s[0])
835
+
805
836
  _output_dir = Path(self.output_dir) / basename
806
837
  _output_dir.mkdir(parents=True, exist_ok=True)
807
838
 
808
- _ass_list: list[Path] = []
809
- _other_sub_list: list[Path] = []
839
+ _ass_list: Final[list[Path]] = add_tr_file_list.copy()
840
+ _other_sub_list: Final[list[Path]] = []
810
841
 
811
842
  for path in self.input_path_list:
812
843
  if path.suffix == ".ass":
@@ -861,6 +892,13 @@ class Ripper:
861
892
  for path in _other_sub_list:
862
893
  shutil.copy2(path, _output_dir / path.name)
863
894
 
895
+ # 清理临时文件
896
+ for f in add_tr_file_list:
897
+ try:
898
+ f.unlink()
899
+ except Exception as e:
900
+ log.error(f"{e!r} {e}", deep=True, is_format=False)
901
+
864
902
  if subset_res is False:
865
903
  log.error("Run {} failed", "subset")
866
904
  return subset_res
@@ -1085,39 +1123,9 @@ class Ripper:
1085
1123
  log.warning("-soft-sub is empty")
1086
1124
  log.info("-soft-sub list = {}", soft_sub_list)
1087
1125
 
1088
- # 临时翻译
1089
- add_tr_files: Final[list[Path]] = []
1090
- if translate_sub := self.option_map.get("translate-sub"):
1091
- _tr = translate_sub.split(":")
1092
- if len(_tr) != 2:
1093
- log.error("{} param illegal", "-translate-sub")
1094
- else:
1095
- try:
1096
- _file_list = translate_subtitles(
1097
- Path(self.output_dir),
1098
- _tr[0],
1099
- _tr[1],
1100
- file_intersection_selector=soft_sub_list,
1101
- )
1102
- except Exception as e:
1103
- log.error(e, is_format=False)
1104
- else:
1105
- for f_and_s in _file_list:
1106
- if f_and_s[0].is_file():
1107
- log.warning(
1108
- 'The file "{}" already exists, skip translating it',
1109
- f_and_s[0],
1110
- )
1111
- continue
1112
- with f_and_s[0].open(
1113
- "wt", encoding="utf-8-sig", newline="\n"
1114
- ) as f:
1115
- f.write(f_and_s[1])
1116
- add_tr_files.append(f_and_s[0])
1117
-
1118
1126
  # 子集化
1119
1127
  if Ripper(
1120
- soft_sub_list + add_tr_files,
1128
+ soft_sub_list,
1121
1129
  (subset_folder.name,),
1122
1130
  self.output_dir,
1123
1131
  Ripper.Preset_name.subset,
@@ -1161,11 +1169,6 @@ class Ripper:
1161
1169
 
1162
1170
  # 清理临时文件
1163
1171
  shutil.rmtree(subset_folder)
1164
- for f in add_tr_files:
1165
- try:
1166
- f.unlink()
1167
- except Exception as e:
1168
- log.error(f"{e!r} {e}", deep=True, is_format=False)
1169
1172
 
1170
1173
  # 获取 ffmpeg report 中的报错
1171
1174
  if FF_REPORT_LOG_FILE.is_file():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: easyrip
3
- Version: 4.11.1
3
+ Version: 4.11.2
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