easyrip 4.11.1__py3-none-any.whl → 4.11.2__py3-none-any.whl

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.
@@ -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
  )
easyrip/global_val.py CHANGED
@@ -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"
easyrip/ripper/param.py CHANGED
@@ -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",
easyrip/ripper/ripper.py CHANGED
@@ -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
@@ -1,10 +1,10 @@
1
1
  easyrip/__init__.py,sha256=PIvSPDgswsIkWL4dsCe87knnxKmtvcrWYzmqAwZix_M,765
2
2
  easyrip/__main__.py,sha256=bPVlHqJb3BG-qZOY4JlJdKj7MKeRb_3EfoMbfoNN-gU,4943
3
- easyrip/easyrip_command.py,sha256=b56InUyV2XXRYsb6Jlh0wB0rrfjAQtLoKvrFDUvhBAc,29250
3
+ easyrip/easyrip_command.py,sha256=IvoNf9Q79nGTvFeCGfq0oz0Cr4jZY7beJAgbWUlUyuk,29633
4
4
  easyrip/easyrip_log.py,sha256=R-dM3CWUBFITtG7GSD1zy4X4MhZqxkoiBPjlIpI76cY,15573
5
5
  easyrip/easyrip_main.py,sha256=l_LMkM0EDpY0N9Ib5O1wSho6k9JG7JIh62ajU622XHE,44710
6
6
  easyrip/easyrip_prompt.py,sha256=RJoE4H_ft4jmlMIBxDcEAfLvLQqabYKUuQUBqJAztlY,2155
7
- easyrip/global_val.py,sha256=iZRAExu6I12ibGcV8FGxwsUU8uvOpp4n7nxFM0yl1kQ,866
7
+ easyrip/global_val.py,sha256=yrFt8nVY7zTtyBeeatvKZsXtYhAGBUoWXHjiao32og4,866
8
8
  easyrip/utils.py,sha256=N1rMF1MyoC-YFBgy10_u29cFoowfhR-5Viea93O7wQ4,8750
9
9
  easyrip/easyrip_config/config.py,sha256=KWXZMEYxdXYUGLQ-MR0A7nnOwR6QZdVrWBopfb2QZSA,9869
10
10
  easyrip/easyrip_config/config_key.py,sha256=_jjdKOunskUoG7UUWOz3QZK-s4LF_x6hmM9MKttyS2Q,766
@@ -12,20 +12,20 @@ easyrip/easyrip_mlang/__init__.py,sha256=QHZt4BYJFkJuaPkN89pt_zkM2grifJakyRZbeyf
12
12
  easyrip/easyrip_mlang/global_lang_val.py,sha256=Un20KGMVVMQbOaV_7VaHg3E1dvK2Y7kI1cPzq_sFWKY,9984
13
13
  easyrip/easyrip_mlang/lang_en.py,sha256=heUSPeVtY1Nf9eDhrjPM28N3PLsu62op3llbXAfXvAs,140
14
14
  easyrip/easyrip_mlang/lang_zh_Hans_CN.py,sha256=N--5dJI9FS3bjZkVVI5htNBvOprvAtkIYjNoTTlvn-Y,18642
15
- easyrip/easyrip_mlang/translator.py,sha256=Vg0S0p2rpMNAy3LHTdK7qKFdkPEXlOoCCXcaH7PyAC4,5939
15
+ easyrip/easyrip_mlang/translator.py,sha256=iTKIOXWmdZ-iOyjmVjMsxx5Q0Vud2y9sqZ_CrUZBG2Q,5944
16
16
  easyrip/easyrip_web/__init__.py,sha256=tMyEeaSGeEJjND7MF0MBv9aDiDgaO3MOnppwxA70U2c,177
17
17
  easyrip/easyrip_web/http_server.py,sha256=iyulCAFQrJlz86Lrr-Dm3fhOnNCf79Bp6fVHhr0ephY,8350
18
18
  easyrip/easyrip_web/third_party_api.py,sha256=GhP6LmR1sVMeLLbnj82r-QYjoUdSnyaU9xp0LRnRLsw,4623
19
19
  easyrip/ripper/media_info.py,sha256=mQq_vbQ7S9fWpb39HLkoZlAL-pqNfwxewv6X776Nf50,5078
20
- easyrip/ripper/param.py,sha256=y1n2XaW55TJQ_r858pB4kYZVgT6TRpmS5vv9iMEIESc,11736
21
- easyrip/ripper/ripper.py,sha256=xTwKpgkqqhh0x6J8DnE5fnXmEN_Q6ZZAdCPky68P-DE,50437
20
+ easyrip/ripper/param.py,sha256=wPy2zMmL0zNk8ShhCA8KmpLs7h4sRpNuEsllF6sGBlI,11734
21
+ easyrip/ripper/ripper.py,sha256=jjQKDepCAPDCnNEk3RQ-r7py-cFDBT5g7pdZMIR60WY,50515
22
22
  easyrip/ripper/sub_and_font/__init__.py,sha256=cBT7mxL7RRFaJXFPXuZ7RT-YK6FbnanaU5v6U9BOquw,153
23
23
  easyrip/ripper/sub_and_font/ass.py,sha256=hJhVN7CqehN9xW1W295gmkPnG-somqlxnwXzRidbA2M,28645
24
24
  easyrip/ripper/sub_and_font/font.py,sha256=X2dPcPzbwQf3fv_g_mxO-zY7puVAX9Nv-9QHn88q4oA,7745
25
25
  easyrip/ripper/sub_and_font/subset.py,sha256=qGH3H26nHnyGFfFwvktEIKncHpm086DqxYjVhNoVDdM,18654
26
- easyrip-4.11.1.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
27
- easyrip-4.11.1.dist-info/METADATA,sha256=H1UAHneIUawu_q9qnTjIeXZPTyiFsiwXi4Qg1uDoB84,3507
28
- easyrip-4.11.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
29
- easyrip-4.11.1.dist-info/entry_points.txt,sha256=D6GBMMTzZ-apgX76KyZ6jxMmIFqGYwU9neeLLni_qKI,49
30
- easyrip-4.11.1.dist-info/top_level.txt,sha256=kuEteBXm-Gf90jRQgH3-fTo-Z-Q6czSuUEqY158H4Ww,8
31
- easyrip-4.11.1.dist-info/RECORD,,
26
+ easyrip-4.11.2.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
27
+ easyrip-4.11.2.dist-info/METADATA,sha256=_KvAAeJEnpiExsKXMhKGTvvvxz4qTinkjtQbzWv8sCI,3507
28
+ easyrip-4.11.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
29
+ easyrip-4.11.2.dist-info/entry_points.txt,sha256=D6GBMMTzZ-apgX76KyZ6jxMmIFqGYwU9neeLLni_qKI,49
30
+ easyrip-4.11.2.dist-info/top_level.txt,sha256=kuEteBXm-Gf90jRQgH3-fTo-Z-Q6czSuUEqY158H4Ww,8
31
+ easyrip-4.11.2.dist-info/RECORD,,