easyrip 4.11.0__py3-none-any.whl → 4.11.1__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.
- easyrip/easyrip_command.py +41 -9
- easyrip/easyrip_config/config.py +2 -2
- easyrip/easyrip_main.py +6 -7
- easyrip/easyrip_prompt.py +2 -2
- easyrip/global_val.py +15 -11
- {easyrip-4.11.0.dist-info → easyrip-4.11.1.dist-info}/METADATA +1 -1
- {easyrip-4.11.0.dist-info → easyrip-4.11.1.dist-info}/RECORD +11 -11
- {easyrip-4.11.0.dist-info → easyrip-4.11.1.dist-info}/WHEEL +0 -0
- {easyrip-4.11.0.dist-info → easyrip-4.11.1.dist-info}/entry_points.txt +0 -0
- {easyrip-4.11.0.dist-info → easyrip-4.11.1.dist-info}/licenses/LICENSE +0 -0
- {easyrip-4.11.0.dist-info → easyrip-4.11.1.dist-info}/top_level.txt +0 -0
easyrip/easyrip_command.py
CHANGED
|
@@ -19,7 +19,7 @@ from prompt_toolkit.document import Document
|
|
|
19
19
|
|
|
20
20
|
from . import global_val
|
|
21
21
|
from .easyrip_config.config_key import Config_key
|
|
22
|
-
from .ripper.param import Audio_codec, Preset_name
|
|
22
|
+
from .ripper.param import PRESET_OPT_NAME, Audio_codec, Preset_name
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
@final
|
|
@@ -763,8 +763,24 @@ class OptCompleter(Completer):
|
|
|
763
763
|
if len(words) >= 1 and not text.startswith("-"):
|
|
764
764
|
return
|
|
765
765
|
|
|
766
|
-
|
|
766
|
+
add_comp_words: set[str] = set()
|
|
767
|
+
add_comp_meta_dict: dict[str, str] = {}
|
|
768
|
+
if _preset := tuple(
|
|
769
|
+
words[i + 1]
|
|
770
|
+
for i, word in enumerate(words[:-1])
|
|
771
|
+
for opt_p_name in Opt_type._preset.value.names
|
|
772
|
+
if word == opt_p_name
|
|
773
|
+
):
|
|
774
|
+
_preset = _preset[-1]
|
|
775
|
+
_preset_name = None
|
|
776
|
+
if _preset in Preset_name._member_map_:
|
|
777
|
+
_preset_name = Preset_name[_preset]
|
|
778
|
+
if _preset_name is not None and _preset_name in PRESET_OPT_NAME:
|
|
779
|
+
add_set: set[str] = {f"-{n}" for n in PRESET_OPT_NAME[_preset_name]}
|
|
780
|
+
add_comp_words |= add_set
|
|
781
|
+
add_comp_meta_dict |= dict.fromkeys(add_set, f"{_preset} param")
|
|
767
782
|
|
|
783
|
+
opt_tree_pos_list: list[nested_dict | Completer] = [self.opt_tree]
|
|
768
784
|
for word in words:
|
|
769
785
|
if isinstance(opt_tree_pos_list[-1], Completer):
|
|
770
786
|
opt_tree_pos_list.append(self.opt_tree.get(word, self.opt_tree))
|
|
@@ -775,7 +791,14 @@ class OptCompleter(Completer):
|
|
|
775
791
|
)
|
|
776
792
|
)
|
|
777
793
|
|
|
778
|
-
if
|
|
794
|
+
if (
|
|
795
|
+
(opt_tree_pos_list[-1] is not self.opt_tree)
|
|
796
|
+
or (words[-1] in add_comp_words)
|
|
797
|
+
) and not text.endswith(" "):
|
|
798
|
+
# 不在根(上个单词没让这个单词回退到根) or 匹配额外提示
|
|
799
|
+
# 且尾部不是空格
|
|
800
|
+
# 即当前单词完全匹配,输出匹配成功提示
|
|
801
|
+
|
|
779
802
|
yield from (
|
|
780
803
|
Completion(
|
|
781
804
|
text=words[-1],
|
|
@@ -786,8 +809,10 @@ class OptCompleter(Completer):
|
|
|
786
809
|
text="",
|
|
787
810
|
display="✔",
|
|
788
811
|
display_meta=(
|
|
789
|
-
|
|
790
|
-
if
|
|
812
|
+
add_comp_meta_dict[words[-1]]
|
|
813
|
+
if words[-1] in add_comp_meta_dict
|
|
814
|
+
else ""
|
|
815
|
+
if (_opt := Opt_type.from_str(words[-1])) is None
|
|
791
816
|
else f"{_desc_list[0]}..."
|
|
792
817
|
if len(_desc_list := _opt.value.description.split("\n")) > 1
|
|
793
818
|
else _desc_list[0]
|
|
@@ -796,6 +821,8 @@ class OptCompleter(Completer):
|
|
|
796
821
|
)
|
|
797
822
|
|
|
798
823
|
elif isinstance(opt_tree_pos_list[-1], Completer):
|
|
824
|
+
# 上个单词进入独立提示,意味着当前的提示可能会是路径提示
|
|
825
|
+
|
|
799
826
|
# 直接使用 PathCompleter 会因为上下文问题失效,所以将上文套进 NestedCompleter
|
|
800
827
|
new_nd: nested_dict = {}
|
|
801
828
|
new_nd_pos: nested_dict = new_nd
|
|
@@ -808,6 +835,8 @@ class OptCompleter(Completer):
|
|
|
808
835
|
)
|
|
809
836
|
|
|
810
837
|
elif len(words) >= 2 and isinstance(opt_tree_pos_list[-2], Completer):
|
|
838
|
+
# 上上个单词进入独立提示
|
|
839
|
+
|
|
811
840
|
new_nd: nested_dict = {}
|
|
812
841
|
new_nd_pos: nested_dict = new_nd
|
|
813
842
|
for word in words[:-2]:
|
|
@@ -837,19 +866,22 @@ class OptCompleter(Completer):
|
|
|
837
866
|
).get_completions(document=document, complete_event=complete_event)
|
|
838
867
|
|
|
839
868
|
else:
|
|
869
|
+
# 没有独立提示
|
|
870
|
+
|
|
840
871
|
yield from FuzzyCompleter(
|
|
841
872
|
WordCompleter(
|
|
842
873
|
words=tuple(
|
|
843
|
-
opt_tree_pos_list[-1]
|
|
874
|
+
set(opt_tree_pos_list[-1])
|
|
844
875
|
| (
|
|
845
|
-
|
|
876
|
+
set()
|
|
846
877
|
if text.endswith(" ")
|
|
847
878
|
or len(words) <= 1
|
|
848
879
|
or isinstance(opt_tree_pos_list[-2], Completer)
|
|
849
|
-
else opt_tree_pos_list[-2]
|
|
880
|
+
else set(opt_tree_pos_list[-2])
|
|
850
881
|
)
|
|
882
|
+
| add_comp_words
|
|
851
883
|
),
|
|
852
|
-
meta_dict=META_DICT_OPT_TYPE,
|
|
884
|
+
meta_dict=META_DICT_OPT_TYPE | add_comp_meta_dict,
|
|
853
885
|
WORD=True, # 匹配标点
|
|
854
886
|
match_middle=True,
|
|
855
887
|
),
|
easyrip/easyrip_config/config.py
CHANGED
|
@@ -5,7 +5,7 @@ from typing import Literal, get_origin, overload
|
|
|
5
5
|
|
|
6
6
|
from ..easyrip_log import log
|
|
7
7
|
from ..easyrip_mlang import all_supported_lang_map, gettext
|
|
8
|
-
from ..global_val import
|
|
8
|
+
from ..global_val import get_CONFIG_DIR
|
|
9
9
|
from ..utils import type_match
|
|
10
10
|
from .config_key import CONFIG_TYPE_DICT, CONFIG_VERSION, Config_key
|
|
11
11
|
|
|
@@ -33,7 +33,7 @@ class config:
|
|
|
33
33
|
|
|
34
34
|
@classmethod
|
|
35
35
|
def init(cls) -> None:
|
|
36
|
-
cls._config_dir =
|
|
36
|
+
cls._config_dir = get_CONFIG_DIR()
|
|
37
37
|
cls._config_file = cls._config_dir / "config.json"
|
|
38
38
|
|
|
39
39
|
if not cls._config_file.is_file():
|
easyrip/easyrip_main.py
CHANGED
|
@@ -221,13 +221,6 @@ def get_input_prompt(is_color: bool = False) -> str:
|
|
|
221
221
|
return f"{os.path.realpath(os.getcwd())}> {cmd_prompt}"
|
|
222
222
|
|
|
223
223
|
|
|
224
|
-
if os.name == "nt":
|
|
225
|
-
try:
|
|
226
|
-
ctypes.windll.user32.SetProcessDPIAware()
|
|
227
|
-
except Exception:
|
|
228
|
-
log.warning("Windows DPI Aware failed")
|
|
229
|
-
|
|
230
|
-
|
|
231
224
|
def file_dialog(
|
|
232
225
|
*,
|
|
233
226
|
is_askdir: bool = False,
|
|
@@ -1086,6 +1079,12 @@ def run_command(command: Iterable[str] | str) -> bool:
|
|
|
1086
1079
|
|
|
1087
1080
|
|
|
1088
1081
|
def init(is_first_run: bool = False) -> None:
|
|
1082
|
+
if os.name == "nt":
|
|
1083
|
+
try:
|
|
1084
|
+
ctypes.windll.user32.SetProcessDPIAware()
|
|
1085
|
+
except Exception:
|
|
1086
|
+
log.warning("Windows DPI Aware failed")
|
|
1087
|
+
|
|
1089
1088
|
if is_first_run:
|
|
1090
1089
|
# 当前路径添加到环境变量
|
|
1091
1090
|
new_path = os.path.realpath(os.getcwd())
|
easyrip/easyrip_prompt.py
CHANGED
|
@@ -5,11 +5,11 @@ from prompt_toolkit.completion import CompleteEvent, Completer, Completion
|
|
|
5
5
|
from prompt_toolkit.document import Document
|
|
6
6
|
from prompt_toolkit.history import FileHistory
|
|
7
7
|
|
|
8
|
-
from .global_val import C_Z,
|
|
8
|
+
from .global_val import C_Z, get_CONFIG_DIR
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class easyrip_prompt:
|
|
12
|
-
PROMPT_HISTORY_FILE =
|
|
12
|
+
PROMPT_HISTORY_FILE = get_CONFIG_DIR() / "prompt_history.txt"
|
|
13
13
|
|
|
14
14
|
@classmethod
|
|
15
15
|
def clear(cls) -> None:
|
easyrip/global_val.py
CHANGED
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import sys
|
|
3
|
+
from functools import cache
|
|
3
4
|
from pathlib import Path
|
|
4
5
|
|
|
5
6
|
PROJECT_NAME = "Easy Rip"
|
|
6
|
-
PROJECT_VERSION = "4.11.
|
|
7
|
+
PROJECT_VERSION = "4.11.1"
|
|
7
8
|
PROJECT_TITLE = f"{PROJECT_NAME} v{PROJECT_VERSION}"
|
|
8
9
|
PROJECT_URL = "https://github.com/op200/EasyRip"
|
|
9
10
|
PROJECT_RELEASE_API = "https://api.github.com/repos/op200/EasyRip/releases/latest"
|
|
10
11
|
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
@cache
|
|
14
|
+
def get_CONFIG_DIR():
|
|
15
|
+
if sys.platform == "win32":
|
|
16
|
+
# Windows: C:\Users\<用户名>\AppData\Roaming\<app_name>
|
|
17
|
+
__config_dir = Path(os.getenv("APPDATA", ""))
|
|
18
|
+
elif sys.platform == "darwin":
|
|
19
|
+
# macOS: ~/Library/Application Support/<app_name>
|
|
20
|
+
__config_dir = Path(os.path.expanduser("~")) / "Library" / "Application Support"
|
|
21
|
+
else:
|
|
22
|
+
# Linux: ~/.config/<app_name>
|
|
23
|
+
__config_dir = Path(os.path.expanduser("~")) / ".config"
|
|
24
|
+
|
|
25
|
+
return Path(__config_dir) / PROJECT_NAME
|
|
22
26
|
|
|
23
27
|
|
|
24
28
|
C_D = "\x04"
|
|
@@ -1,12 +1,12 @@
|
|
|
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=
|
|
3
|
+
easyrip/easyrip_command.py,sha256=b56InUyV2XXRYsb6Jlh0wB0rrfjAQtLoKvrFDUvhBAc,29250
|
|
4
4
|
easyrip/easyrip_log.py,sha256=R-dM3CWUBFITtG7GSD1zy4X4MhZqxkoiBPjlIpI76cY,15573
|
|
5
|
-
easyrip/easyrip_main.py,sha256=
|
|
6
|
-
easyrip/easyrip_prompt.py,sha256=
|
|
7
|
-
easyrip/global_val.py,sha256=
|
|
5
|
+
easyrip/easyrip_main.py,sha256=l_LMkM0EDpY0N9Ib5O1wSho6k9JG7JIh62ajU622XHE,44710
|
|
6
|
+
easyrip/easyrip_prompt.py,sha256=RJoE4H_ft4jmlMIBxDcEAfLvLQqabYKUuQUBqJAztlY,2155
|
|
7
|
+
easyrip/global_val.py,sha256=iZRAExu6I12ibGcV8FGxwsUU8uvOpp4n7nxFM0yl1kQ,866
|
|
8
8
|
easyrip/utils.py,sha256=N1rMF1MyoC-YFBgy10_u29cFoowfhR-5Viea93O7wQ4,8750
|
|
9
|
-
easyrip/easyrip_config/config.py,sha256=
|
|
9
|
+
easyrip/easyrip_config/config.py,sha256=KWXZMEYxdXYUGLQ-MR0A7nnOwR6QZdVrWBopfb2QZSA,9869
|
|
10
10
|
easyrip/easyrip_config/config_key.py,sha256=_jjdKOunskUoG7UUWOz3QZK-s4LF_x6hmM9MKttyS2Q,766
|
|
11
11
|
easyrip/easyrip_mlang/__init__.py,sha256=QHZt4BYJFkJuaPkN89pt_zkM2grifJakyRZbeyfH8f4,1893
|
|
12
12
|
easyrip/easyrip_mlang/global_lang_val.py,sha256=Un20KGMVVMQbOaV_7VaHg3E1dvK2Y7kI1cPzq_sFWKY,9984
|
|
@@ -23,9 +23,9 @@ easyrip/ripper/sub_and_font/__init__.py,sha256=cBT7mxL7RRFaJXFPXuZ7RT-YK6FbnanaU
|
|
|
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.
|
|
27
|
-
easyrip-4.11.
|
|
28
|
-
easyrip-4.11.
|
|
29
|
-
easyrip-4.11.
|
|
30
|
-
easyrip-4.11.
|
|
31
|
-
easyrip-4.11.
|
|
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,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|