easyrip 4.6.1__tar.gz → 4.8.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.6.1 → easyrip-4.8.0}/PKG-INFO +1 -1
  2. {easyrip-4.6.1 → easyrip-4.8.0}/easyrip/easyrip_log.py +1 -1
  3. {easyrip-4.6.1 → easyrip-4.8.0}/easyrip/easyrip_main.py +35 -10
  4. {easyrip-4.6.1 → easyrip-4.8.0}/easyrip/easyrip_mlang/lang_zh_Hans_CN.py +1 -1
  5. {easyrip-4.6.1 → easyrip-4.8.0}/easyrip/easyrip_web/third_party_api.py +7 -2
  6. {easyrip-4.6.1 → easyrip-4.8.0}/easyrip/global_val.py +1 -1
  7. {easyrip-4.6.1 → easyrip-4.8.0}/easyrip/ripper/param.py +65 -45
  8. {easyrip-4.6.1 → easyrip-4.8.0}/easyrip/ripper/ripper.py +6 -2
  9. {easyrip-4.6.1 → easyrip-4.8.0}/easyrip.egg-info/PKG-INFO +1 -1
  10. {easyrip-4.6.1 → easyrip-4.8.0}/LICENSE +0 -0
  11. {easyrip-4.6.1 → easyrip-4.8.0}/README.md +0 -0
  12. {easyrip-4.6.1 → easyrip-4.8.0}/easyrip/__init__.py +0 -0
  13. {easyrip-4.6.1 → easyrip-4.8.0}/easyrip/__main__.py +0 -0
  14. {easyrip-4.6.1 → easyrip-4.8.0}/easyrip/easyrip_command.py +0 -0
  15. {easyrip-4.6.1 → easyrip-4.8.0}/easyrip/easyrip_config/config.py +0 -0
  16. {easyrip-4.6.1 → easyrip-4.8.0}/easyrip/easyrip_config/config_key.py +0 -0
  17. {easyrip-4.6.1 → easyrip-4.8.0}/easyrip/easyrip_mlang/__init__.py +0 -0
  18. {easyrip-4.6.1 → easyrip-4.8.0}/easyrip/easyrip_mlang/global_lang_val.py +0 -0
  19. {easyrip-4.6.1 → easyrip-4.8.0}/easyrip/easyrip_mlang/lang_en.py +0 -0
  20. {easyrip-4.6.1 → easyrip-4.8.0}/easyrip/easyrip_mlang/translator.py +0 -0
  21. {easyrip-4.6.1 → easyrip-4.8.0}/easyrip/easyrip_prompt.py +0 -0
  22. {easyrip-4.6.1 → easyrip-4.8.0}/easyrip/easyrip_web/__init__.py +0 -0
  23. {easyrip-4.6.1 → easyrip-4.8.0}/easyrip/easyrip_web/http_server.py +0 -0
  24. {easyrip-4.6.1 → easyrip-4.8.0}/easyrip/ripper/media_info.py +0 -0
  25. {easyrip-4.6.1 → easyrip-4.8.0}/easyrip/ripper/sub_and_font/__init__.py +0 -0
  26. {easyrip-4.6.1 → easyrip-4.8.0}/easyrip/ripper/sub_and_font/ass.py +0 -0
  27. {easyrip-4.6.1 → easyrip-4.8.0}/easyrip/ripper/sub_and_font/font.py +0 -0
  28. {easyrip-4.6.1 → easyrip-4.8.0}/easyrip/ripper/sub_and_font/subset.py +0 -0
  29. {easyrip-4.6.1 → easyrip-4.8.0}/easyrip/utils.py +0 -0
  30. {easyrip-4.6.1 → easyrip-4.8.0}/easyrip.egg-info/SOURCES.txt +0 -0
  31. {easyrip-4.6.1 → easyrip-4.8.0}/easyrip.egg-info/dependency_links.txt +0 -0
  32. {easyrip-4.6.1 → easyrip-4.8.0}/easyrip.egg-info/entry_points.txt +0 -0
  33. {easyrip-4.6.1 → easyrip-4.8.0}/easyrip.egg-info/requires.txt +0 -0
  34. {easyrip-4.6.1 → easyrip-4.8.0}/easyrip.egg-info/top_level.txt +0 -0
  35. {easyrip-4.6.1 → easyrip-4.8.0}/pyproject.toml +0 -0
  36. {easyrip-4.6.1 → easyrip-4.8.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: easyrip
3
- Version: 4.6.1
3
+ Version: 4.8.0
4
4
  Author: op200
5
5
  License-Expression: AGPL-3.0-or-later
6
6
  Project-URL: Homepage, https://github.com/op200/EasyRip
@@ -106,7 +106,7 @@ class log:
106
106
  only_print = enum.auto()
107
107
  only_write = enum.auto()
108
108
 
109
- html_filename: str = "encoding_log.html" # 在调用前覆写
109
+ html_filename: str = "EasyRip_log.html" # 在调用前覆写
110
110
  print_level: LogLevel = LogLevel.send
111
111
  write_level: LogLevel = LogLevel.send
112
112
 
@@ -8,6 +8,7 @@ import shlex
8
8
  import shutil
9
9
  import subprocess
10
10
  import sys
11
+ import textwrap
11
12
  import threading
12
13
  import tkinter as tk
13
14
  import tomllib
@@ -36,7 +37,8 @@ from .easyrip_mlang import (
36
37
  )
37
38
  from .easyrip_prompt import easyrip_prompt
38
39
  from .ripper.media_info import Media_info
39
- from .ripper.ripper import DEFAULT_PRESET_PARAMS, Ripper
40
+ from .ripper.ripper import Ripper
41
+ from .ripper.param import DEFAULT_PRESET_PARAMS, PRESET_OPT_NAME
40
42
  from .ripper.sub_and_font import load_fonts
41
43
  from .utils import change_title, check_ver, read_text
42
44
 
@@ -424,16 +426,39 @@ def run_command(command: Iterable[str] | str) -> bool:
424
426
  log.send(_want_doc_cmd_type.value.to_doc(), is_format=False)
425
427
  elif cmd_list[2] in Ripper.Preset_name._value2member_map_:
426
428
  _preset = Ripper.Preset_name(cmd_list[2])
427
- if _preset in DEFAULT_PRESET_PARAMS:
428
- log.send(
429
- json.dumps(
430
- DEFAULT_PRESET_PARAMS[_preset], indent=2
431
- ),
432
- is_format=False,
433
- )
429
+ if (
430
+ _preset in DEFAULT_PRESET_PARAMS
431
+ or _preset in PRESET_OPT_NAME
432
+ ):
433
+ if _preset in PRESET_OPT_NAME:
434
+ log.send(
435
+ "Params that can be directly used:\n{}",
436
+ textwrap.indent(
437
+ "\n".join(
438
+ f"-{n}"
439
+ for n in PRESET_OPT_NAME[_preset]
440
+ ),
441
+ prefix=" ",
442
+ ),
443
+ )
444
+ if _preset in DEFAULT_PRESET_PARAMS:
445
+ _default_params = DEFAULT_PRESET_PARAMS[_preset]
446
+ max_name_len = (
447
+ max(len(str(n)) for n in _default_params) + 1
448
+ )
449
+ log.send(
450
+ "Default val:\n{}",
451
+ textwrap.indent(
452
+ "\n".join(
453
+ f"{f'-{n}':>{max_name_len}} {v}"
454
+ for n, v in _default_params.items()
455
+ ),
456
+ prefix=" ",
457
+ ),
458
+ )
434
459
  else:
435
460
  log.send(
436
- "The preset '{}' has no default val", cmd_list[2]
461
+ "The preset '{}' has no separate help", cmd_list[2]
437
462
  )
438
463
  else:
439
464
  log.error("'{}' is not a member of preset", cmd_list[2])
@@ -1080,7 +1105,7 @@ def init(is_first_run: bool = False) -> None:
1080
1105
  Global_lang_val.gettext_target_lang = Lang_tag.from_str(str(_lang_config))
1081
1106
 
1082
1107
  # 设置日志文件路径名
1083
- log.html_filename = gettext("encoding_log.html")
1108
+ log.html_filename = gettext(log.html_filename)
1084
1109
  if _path := str(config.get_user_profile(Config_key.force_log_file_path) or ""):
1085
1110
  log.html_filename = os.path.join(_path, log.html_filename)
1086
1111
 
@@ -308,7 +308,7 @@ LANG_MAP: dict[str, str] = {
308
308
  "Current work directory has an other Easy Rip is running: {}": "当前工作目录存在其他 Easy Rip 正在运行: {}",
309
309
  "Stop run command": "命令执行终止",
310
310
  # log
311
- "encoding_log.html": "编码日志.html",
311
+ "EasyRip_log.html": "EasyRip日志.html",
312
312
  "Start": "开始",
313
313
  "Input file pathname": "输入文件路径名",
314
314
  "Output directory": "输出目录",
@@ -82,8 +82,13 @@ class github:
82
82
 
83
83
  try:
84
84
  with urllib.request.urlopen(req) as response:
85
- data = json.loads(response.read().decode("utf-8"))
86
- return data.get("tag_name")
85
+ data: dict = json.loads(response.read().decode("utf-8"))
86
+ ver = data.get("tag_name")
87
+ if ver is None:
88
+ return None
89
+ if isinstance(ver, str):
90
+ return ver.lstrip("v")
91
+ raise ValueError(f"ver = {ver!r}")
87
92
  except Exception as e:
88
93
  log.debug(
89
94
  "'{}' execution failed: {}",
@@ -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.1"
6
+ PROJECT_VERSION = "4.8.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"
@@ -120,50 +120,6 @@ class Muxer(enum.Enum):
120
120
  return DEFAULT
121
121
 
122
122
 
123
- _DEFAULT_X265_PARAMS: Final[dict[LiteralString, LiteralString]] = {
124
- "crf": "20",
125
- "qpmin": "6",
126
- "qpmax": "32",
127
- "rd": "3",
128
- "psy-rd": "2",
129
- "rdoq-level": "0",
130
- "psy-rdoq": "0",
131
- "qcomp": "0.68",
132
- "keyint": "250",
133
- "min-keyint": "2",
134
- "deblock": "0,0",
135
- "me": "umh",
136
- "merange": "57",
137
- "hme": "1",
138
- "hme-search": "hex,hex,hex",
139
- "hme-range": "16,57,92",
140
- "aq-mode": "2",
141
- "aq-strength": "1",
142
- "tu-intra-depth": "1",
143
- "tu-inter-depth": "1",
144
- "limit-tu": "0",
145
- "bframes": "16",
146
- "ref": "8",
147
- "subme": "2",
148
- "open-gop": "1",
149
- "gop-lookahead": "0",
150
- "rc-lookahead": "20",
151
- "rect": "0",
152
- "amp": "0",
153
- "cbqpoffs": "0",
154
- "crqpoffs": "0",
155
- "ipratio": "1.4",
156
- "pbratio": "1.3",
157
- "early-skip": "1",
158
- "ctu": "64",
159
- "min-cu-size": "8",
160
- "max-tu-size": "32",
161
- "level-idc": "0",
162
- "sao": "0",
163
- "weightb": "1",
164
- "info": "1",
165
- }
166
-
167
123
  X265_PARAMS_NAME: Final[tuple[LiteralString, ...]] = (
168
124
  "crf",
169
125
  "qpmin",
@@ -205,7 +161,6 @@ X265_PARAMS_NAME: Final[tuple[LiteralString, ...]] = (
205
161
  "level-idc",
206
162
  "sao",
207
163
  )
208
-
209
164
  X264_PARAMS_NAME: Final[tuple[LiteralString, ...]] = (
210
165
  "threads",
211
166
  "crf",
@@ -225,8 +180,68 @@ X264_PARAMS_NAME: Final[tuple[LiteralString, ...]] = (
225
180
  "min-keyint",
226
181
  "trellis",
227
182
  "fast-pskip",
183
+ "partitions",
184
+ "direct",
228
185
  )
229
186
 
187
+
188
+ _DEFAULT_X265_PARAMS: Final[dict[LiteralString, LiteralString]] = {
189
+ "crf": "20",
190
+ "qpmin": "6",
191
+ "qpmax": "32",
192
+ "rd": "3",
193
+ "psy-rd": "2",
194
+ "rdoq-level": "0",
195
+ "psy-rdoq": "0",
196
+ "qcomp": "0.68",
197
+ "keyint": "250",
198
+ "min-keyint": "2",
199
+ "deblock": "0,0",
200
+ "me": "umh",
201
+ "merange": "57",
202
+ "hme": "1",
203
+ "hme-search": "hex,hex,hex",
204
+ "hme-range": "16,57,92",
205
+ "aq-mode": "2",
206
+ "aq-strength": "1",
207
+ "tu-intra-depth": "1",
208
+ "tu-inter-depth": "1",
209
+ "limit-tu": "0",
210
+ "bframes": "16",
211
+ "ref": "8",
212
+ "subme": "2",
213
+ "open-gop": "1",
214
+ "gop-lookahead": "0",
215
+ "rc-lookahead": "20",
216
+ "rect": "0",
217
+ "amp": "0",
218
+ "cbqpoffs": "0",
219
+ "crqpoffs": "0",
220
+ "ipratio": "1.4",
221
+ "pbratio": "1.3",
222
+ "early-skip": "1",
223
+ "ctu": "64",
224
+ "min-cu-size": "8",
225
+ "max-tu-size": "32",
226
+ "level-idc": "0",
227
+ "sao": "0",
228
+ "weightb": "1",
229
+ "info": "1",
230
+ }
231
+
232
+
233
+ PRESET_OPT_NAME: Final[dict[Preset_name, tuple[LiteralString, ...]]] = {
234
+ Preset_name.x264: X264_PARAMS_NAME,
235
+ Preset_name.x264fast: X264_PARAMS_NAME,
236
+ Preset_name.x264slow: X264_PARAMS_NAME,
237
+ Preset_name.x265: X265_PARAMS_NAME,
238
+ Preset_name.x265fast4: X265_PARAMS_NAME,
239
+ Preset_name.x265fast3: X265_PARAMS_NAME,
240
+ Preset_name.x265fast2: X265_PARAMS_NAME,
241
+ Preset_name.x265fast: X265_PARAMS_NAME,
242
+ Preset_name.x265slow: X265_PARAMS_NAME,
243
+ Preset_name.x265full: X265_PARAMS_NAME,
244
+ }
230
245
  DEFAULT_PRESET_PARAMS: Final[dict[Preset_name, dict[LiteralString, LiteralString]]] = {
231
246
  Preset_name.x264fast: {
232
247
  "threads": "auto",
@@ -248,6 +263,8 @@ DEFAULT_PRESET_PARAMS: Final[dict[Preset_name, dict[LiteralString, LiteralString
248
263
  "trellis": "1",
249
264
  "fast-pskip": "1",
250
265
  "weightb": "1",
266
+ "partitions": "all",
267
+ "direct": "auto",
251
268
  },
252
269
  Preset_name.x264slow: {
253
270
  "threads": "auto",
@@ -269,6 +286,8 @@ DEFAULT_PRESET_PARAMS: Final[dict[Preset_name, dict[LiteralString, LiteralString
269
286
  "trellis": "2",
270
287
  "fast-pskip": "0",
271
288
  "weightb": "1",
289
+ "partitions": "all",
290
+ "direct": "auto",
272
291
  },
273
292
  Preset_name.x265fast4: _DEFAULT_X265_PARAMS
274
293
  | dict[LiteralString, LiteralString](
@@ -448,6 +467,7 @@ DEFAULT_PRESET_PARAMS: Final[dict[Preset_name, dict[LiteralString, LiteralString
448
467
  ),
449
468
  }
450
469
 
470
+
451
471
  SUBTITLE_SUFFIX_SET: Final[set[LiteralString]] = {
452
472
  ".srt",
453
473
  ".ass",
@@ -643,7 +643,9 @@ class Ripper:
643
643
  _option_map = {
644
644
  "crf": self.option_map.get("crf"),
645
645
  "qp": self.option_map.get("qp"),
646
- "pix_fmt": self.option_map.get("pix_fmt"),
646
+ "pix_fmt": self.option_map.get(
647
+ "pix_fmt", None if is_pipe_input else "yuv420p10le"
648
+ ),
647
649
  "preset:v": self.option_map.get("preset:v"),
648
650
  "svtav1-params": self.option_map.get("svtav1-params"),
649
651
  }
@@ -664,7 +666,9 @@ class Ripper:
664
666
  case Ripper.Preset_name.vvenc:
665
667
  _option_map = {
666
668
  "qp": self.option_map.get("qp"),
667
- "pix_fmt": self.option_map.get("pix_fmt"),
669
+ "pix_fmt": self.option_map.get(
670
+ "pix_fmt", None if is_pipe_input else "yuv420p10le"
671
+ ),
668
672
  "preset:v": self.option_map.get("preset:v"),
669
673
  "vvenc-params": self.option_map.get("vvenc-params"),
670
674
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: easyrip
3
- Version: 4.6.1
3
+ Version: 4.8.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