easyrip 4.9.0__py3-none-any.whl → 4.10.0__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/__main__.py +12 -2
- easyrip/easyrip_log.py +0 -4
- easyrip/easyrip_main.py +1 -1
- easyrip/global_val.py +1 -1
- easyrip/ripper/ripper.py +4 -0
- easyrip/ripper/sub_and_font/ass.py +131 -119
- {easyrip-4.9.0.dist-info → easyrip-4.10.0.dist-info}/METADATA +1 -1
- {easyrip-4.9.0.dist-info → easyrip-4.10.0.dist-info}/RECORD +12 -12
- {easyrip-4.9.0.dist-info → easyrip-4.10.0.dist-info}/WHEEL +0 -0
- {easyrip-4.9.0.dist-info → easyrip-4.10.0.dist-info}/entry_points.txt +0 -0
- {easyrip-4.9.0.dist-info → easyrip-4.10.0.dist-info}/licenses/LICENSE +0 -0
- {easyrip-4.9.0.dist-info → easyrip-4.10.0.dist-info}/top_level.txt +0 -0
easyrip/__main__.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import sys
|
|
2
|
-
from collections.abc import Iterable
|
|
3
|
-
from typing import NoReturn
|
|
2
|
+
from collections.abc import Coroutine, Iterable
|
|
3
|
+
from typing import Any, NoReturn
|
|
4
4
|
|
|
5
5
|
import Crypto
|
|
6
6
|
import fontTools
|
|
@@ -8,7 +8,9 @@ import prompt_toolkit
|
|
|
8
8
|
from prompt_toolkit import ANSI, prompt
|
|
9
9
|
from prompt_toolkit.completion import merge_completers
|
|
10
10
|
from prompt_toolkit.history import InMemoryHistory
|
|
11
|
+
from prompt_toolkit.input.ansi_escape_sequences import ANSI_SEQUENCES
|
|
11
12
|
from prompt_toolkit.key_binding import KeyBindings, KeyPressEvent
|
|
13
|
+
from prompt_toolkit.key_binding.bindings import named_commands
|
|
12
14
|
from prompt_toolkit.keys import Keys
|
|
13
15
|
|
|
14
16
|
from .easyrip_command import (
|
|
@@ -48,6 +50,14 @@ def run() -> NoReturn:
|
|
|
48
50
|
def _(event: KeyPressEvent) -> None:
|
|
49
51
|
event.app.current_buffer.insert_text(C_D)
|
|
50
52
|
|
|
53
|
+
ANSI_SEQUENCES["\x08"] = Keys.F24
|
|
54
|
+
|
|
55
|
+
@key_bindings.add(Keys.F24)
|
|
56
|
+
def _(
|
|
57
|
+
event: KeyPressEvent,
|
|
58
|
+
) -> object | Coroutine[Any, Any, object]:
|
|
59
|
+
return named_commands.get_by_name("unix-word-rubout").handler(event)
|
|
60
|
+
|
|
51
61
|
path_completer = SmartPathCompleter()
|
|
52
62
|
|
|
53
63
|
def _ctv_to_nc(ctvs: Iterable[Cmd_type_val]) -> CmdCompleter:
|
easyrip/easyrip_log.py
CHANGED
easyrip/easyrip_main.py
CHANGED
|
@@ -37,8 +37,8 @@ from .easyrip_mlang import (
|
|
|
37
37
|
)
|
|
38
38
|
from .easyrip_prompt import easyrip_prompt
|
|
39
39
|
from .ripper.media_info import Media_info
|
|
40
|
-
from .ripper.ripper import Ripper
|
|
41
40
|
from .ripper.param import DEFAULT_PRESET_PARAMS, PRESET_OPT_NAME
|
|
41
|
+
from .ripper.ripper import Ripper
|
|
42
42
|
from .ripper.sub_and_font import load_fonts
|
|
43
43
|
from .utils import change_title, check_ver, read_text
|
|
44
44
|
|
easyrip/global_val.py
CHANGED
|
@@ -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
|
+
PROJECT_VERSION = "4.10.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"
|
easyrip/ripper/ripper.py
CHANGED
|
@@ -1051,6 +1051,7 @@ class Ripper:
|
|
|
1051
1051
|
# 处理 soft-sub
|
|
1052
1052
|
soft_sub_list: list[Path]
|
|
1053
1053
|
soft_sub_map_list: list[str] = soft_sub.split(":")
|
|
1054
|
+
|
|
1054
1055
|
if soft_sub_map_list[0] == "auto":
|
|
1055
1056
|
soft_sub_list = []
|
|
1056
1057
|
|
|
@@ -1075,10 +1076,13 @@ class Ripper:
|
|
|
1075
1076
|
)
|
|
1076
1077
|
):
|
|
1077
1078
|
soft_sub_list.append(Path(self.output_dir) / _file_basename)
|
|
1079
|
+
|
|
1078
1080
|
else:
|
|
1079
1081
|
soft_sub_list = [Path(s) for s in soft_sub.split("?")]
|
|
1080
1082
|
|
|
1081
1083
|
subset_folder = Path(self.output_dir) / f"subset_temp_{temp_name}"
|
|
1084
|
+
if not soft_sub_list:
|
|
1085
|
+
log.warning("-soft-sub is empty")
|
|
1082
1086
|
log.info("-soft-sub list = {}", soft_sub_list)
|
|
1083
1087
|
|
|
1084
1088
|
# 临时翻译
|
|
@@ -63,7 +63,7 @@ class Script_info:
|
|
|
63
63
|
class Style_data:
|
|
64
64
|
Name: str
|
|
65
65
|
Fontname: str
|
|
66
|
-
Fontsize:
|
|
66
|
+
Fontsize: float
|
|
67
67
|
PrimaryColour: str
|
|
68
68
|
SecondaryColour: str
|
|
69
69
|
OutlineColour: str
|
|
@@ -212,7 +212,7 @@ class Styles:
|
|
|
212
212
|
res = Style_data(
|
|
213
213
|
Name=style_tuple[self.fmt_index[Style_fmt_it.Name]],
|
|
214
214
|
Fontname=style_tuple[self.fmt_index[Style_fmt_it.Fontname]],
|
|
215
|
-
Fontsize=
|
|
215
|
+
Fontsize=float(style_tuple[self.fmt_index[Style_fmt_it.Fontsize]]),
|
|
216
216
|
PrimaryColour=style_tuple[self.fmt_index[Style_fmt_it.PrimaryColour]],
|
|
217
217
|
SecondaryColour=style_tuple[
|
|
218
218
|
self.fmt_index[Style_fmt_it.SecondaryColour]
|
|
@@ -613,137 +613,149 @@ class Ass:
|
|
|
613
613
|
new_unknown_data: Unknown_data | None = None
|
|
614
614
|
|
|
615
615
|
for line in filter(bool, map(str.strip, read_text(path).splitlines())):
|
|
616
|
-
|
|
617
|
-
if
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
616
|
+
try:
|
|
617
|
+
if line.startswith("[") and line.endswith("]"):
|
|
618
|
+
if new_unknown_data is not None:
|
|
619
|
+
self.unknown_data.append(new_unknown_data)
|
|
620
|
+
new_unknown_data = None
|
|
621
|
+
|
|
622
|
+
match head := line[1:-1]:
|
|
623
|
+
case "Script Info":
|
|
624
|
+
state = State.script_info
|
|
625
|
+
case "V4+ Styles":
|
|
626
|
+
state = State.styles
|
|
627
|
+
case "Fonts":
|
|
628
|
+
state = State.fonts
|
|
629
|
+
case "Graphics":
|
|
630
|
+
state = State.graphics
|
|
631
|
+
case "Events":
|
|
632
|
+
state = State.events
|
|
633
|
+
case _:
|
|
634
|
+
if bool(re.search(r"[a-z]", head)):
|
|
635
|
+
state = State.unknown
|
|
636
|
+
new_unknown_data = Unknown_data(head=head)
|
|
637
|
+
|
|
638
|
+
elif line.startswith("Format:"):
|
|
639
|
+
formats_tuple = tuple(map(str.strip, line[7:].split(",")))
|
|
640
|
+
match state:
|
|
641
|
+
case State.styles:
|
|
642
|
+
format_order = tuple(map(Style_fmt_it, formats_tuple))
|
|
643
|
+
if len(format_order) != 23:
|
|
644
|
+
raise Ass_generate_error("Style Format len != 23")
|
|
645
|
+
|
|
646
|
+
self.styles.fmt_order = format_order
|
|
647
|
+
|
|
648
|
+
case State.events:
|
|
649
|
+
try:
|
|
650
|
+
format_order = tuple(
|
|
651
|
+
map(Event_fmt_it.__getitem__, formats_tuple)
|
|
652
|
+
)
|
|
653
|
+
except ValueError as e:
|
|
654
|
+
raise Ass_generate_error from e
|
|
654
655
|
|
|
655
|
-
|
|
656
|
-
|
|
656
|
+
if len(format_order) != 10:
|
|
657
|
+
raise Ass_generate_error("Event Format len != 10")
|
|
657
658
|
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
659
|
+
if "Marked" in formats_tuple:
|
|
660
|
+
log.error(
|
|
661
|
+
"The ASS Events Format version too old: {}",
|
|
662
|
+
"It used 'Marked' instead of 'Layer'. 'Marked' has been replaced with 'Layer', which will result in irreversible info loss",
|
|
663
|
+
)
|
|
663
664
|
|
|
664
|
-
|
|
665
|
+
self.events.fmt_order = format_order
|
|
665
666
|
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
667
|
+
else:
|
|
668
|
+
match state:
|
|
669
|
+
case State.script_info:
|
|
670
|
+
self.script_info.data.append(Script_info_data(raw_str=line))
|
|
671
|
+
|
|
672
|
+
case State.styles:
|
|
673
|
+
if not line.startswith("Style:"):
|
|
674
|
+
log.warning(
|
|
675
|
+
"Skip a Style line (illegal format): {}", line
|
|
676
|
+
)
|
|
677
|
+
continue
|
|
678
|
+
|
|
679
|
+
style_tuple = tuple(map(str.strip, line[6:].split(",")))
|
|
680
|
+
if len(style_tuple) != 23:
|
|
681
|
+
log.warning(
|
|
682
|
+
"Skip a Style line (Style Format len != 23): {}",
|
|
683
|
+
line,
|
|
684
|
+
)
|
|
685
|
+
continue
|
|
682
686
|
|
|
683
|
-
|
|
687
|
+
self.styles.data.append(self.styles.new_data(style_tuple))
|
|
684
688
|
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
689
|
+
case State.graphics:
|
|
690
|
+
if line.startswith("filename:"):
|
|
691
|
+
self.attachments.data.append(
|
|
692
|
+
Attachment_data(
|
|
693
|
+
type=Attach_type.Graphics,
|
|
694
|
+
name=line[9:].strip(),
|
|
695
|
+
data="",
|
|
696
|
+
)
|
|
697
|
+
)
|
|
698
|
+
else:
|
|
699
|
+
if self.attachments.data[-1].data is None:
|
|
700
|
+
log.error("Unknown error", deep=True)
|
|
701
|
+
continue
|
|
702
|
+
self.attachments.data[-1].data += line + "\n"
|
|
703
|
+
|
|
704
|
+
case State.fonts:
|
|
705
|
+
if line.startswith("fontname:"):
|
|
706
|
+
self.attachments.data.append(
|
|
707
|
+
Attachment_data(
|
|
708
|
+
type=Attach_type.Fonts,
|
|
709
|
+
name=line[9:].strip(),
|
|
710
|
+
data="",
|
|
711
|
+
)
|
|
712
|
+
)
|
|
713
|
+
else:
|
|
714
|
+
if self.attachments.data[-1].data is None:
|
|
715
|
+
log.error("Unknown error", deep=True)
|
|
716
|
+
continue
|
|
717
|
+
self.attachments.data[-1].data += line + "\n"
|
|
718
|
+
|
|
719
|
+
case State.events:
|
|
720
|
+
event_type: Event_type
|
|
721
|
+
if line.startswith("Dialogue:"):
|
|
722
|
+
event_type = Event_type.Dialogue
|
|
723
|
+
elif line.startswith("Comment:"):
|
|
724
|
+
event_type = Event_type.Comment
|
|
725
|
+
else:
|
|
726
|
+
log.warning(
|
|
727
|
+
"Skip a Event line (illegal format): {}", line
|
|
692
728
|
)
|
|
693
|
-
)
|
|
694
|
-
else:
|
|
695
|
-
if self.attachments.data[-1].data is None:
|
|
696
|
-
log.error("Unknown error", deep=True)
|
|
697
729
|
continue
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
name=line[9:].strip(),
|
|
706
|
-
data="",
|
|
730
|
+
|
|
731
|
+
event_tuple = tuple(
|
|
732
|
+
map(
|
|
733
|
+
str.strip,
|
|
734
|
+
line.split(":", maxsplit=1)[1].split(
|
|
735
|
+
",", maxsplit=9
|
|
736
|
+
),
|
|
707
737
|
)
|
|
708
738
|
)
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
739
|
+
if len(event_tuple) != 10:
|
|
740
|
+
log.warning(
|
|
741
|
+
"Skip a Event line (Event Format len != 10): {}",
|
|
742
|
+
line,
|
|
743
|
+
)
|
|
712
744
|
continue
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
event_type: Event_type
|
|
717
|
-
if line.startswith("Dialogue:"):
|
|
718
|
-
event_type = Event_type.Dialogue
|
|
719
|
-
elif line.startswith("Comment:"):
|
|
720
|
-
event_type = Event_type.Comment
|
|
721
|
-
else:
|
|
722
|
-
log.warning("Skip a Event line (illegal format): {}", line)
|
|
723
|
-
continue
|
|
724
|
-
|
|
725
|
-
event_tuple = tuple(
|
|
726
|
-
map(
|
|
727
|
-
str.strip,
|
|
728
|
-
line.split(":", maxsplit=1)[1].split(",", maxsplit=9),
|
|
729
|
-
)
|
|
730
|
-
)
|
|
731
|
-
if len(event_tuple) != 10:
|
|
732
|
-
log.warning(
|
|
733
|
-
"Skip a Event line (Event Format len != 10): {}", line
|
|
745
|
+
|
|
746
|
+
self.events.data.append(
|
|
747
|
+
self.events.new_data(event_tuple, event_type)
|
|
734
748
|
)
|
|
735
|
-
continue
|
|
736
749
|
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
750
|
+
case State.unknown:
|
|
751
|
+
if new_unknown_data is None:
|
|
752
|
+
raise Ass_generate_error(
|
|
753
|
+
"Unknown error occurred when read line: {}", line
|
|
754
|
+
)
|
|
755
|
+
new_unknown_data.data.append(line)
|
|
740
756
|
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
raise Ass_generate_error(
|
|
744
|
-
"Unknown error occurred when read line: {}", line
|
|
745
|
-
)
|
|
746
|
-
new_unknown_data.data.append(line)
|
|
757
|
+
except Exception as e:
|
|
758
|
+
raise Ass_generate_error("Unkown error in line: {}", line) from e
|
|
747
759
|
|
|
748
760
|
if new_unknown_data is not None:
|
|
749
761
|
self.unknown_data.append(new_unknown_data)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
easyrip/__init__.py,sha256=PIvSPDgswsIkWL4dsCe87knnxKmtvcrWYzmqAwZix_M,765
|
|
2
|
-
easyrip/__main__.py,sha256=
|
|
2
|
+
easyrip/__main__.py,sha256=bPVlHqJb3BG-qZOY4JlJdKj7MKeRb_3EfoMbfoNN-gU,4943
|
|
3
3
|
easyrip/easyrip_command.py,sha256=X9_8t9Sxl1-gILpsQ5PueCwozTQgjgL2cImzOZ6pO7w,27837
|
|
4
|
-
easyrip/easyrip_log.py,sha256=
|
|
5
|
-
easyrip/easyrip_main.py,sha256=
|
|
4
|
+
easyrip/easyrip_log.py,sha256=R-dM3CWUBFITtG7GSD1zy4X4MhZqxkoiBPjlIpI76cY,15573
|
|
5
|
+
easyrip/easyrip_main.py,sha256=QgIrsonjXNin72nv7WWePTlpj9soGZCBVv1cwFNS4a4,44691
|
|
6
6
|
easyrip/easyrip_prompt.py,sha256=A5S7ybeJSGFkCmwdJ9TCQ_-lde7NWgkbFytZ2KnvkWI,2145
|
|
7
|
-
easyrip/global_val.py,sha256=
|
|
7
|
+
easyrip/global_val.py,sha256=P4tP5GtjMQAkrsLQ6TnnhkQeUnyFZhYtA_NIFIjx5Gg,774
|
|
8
8
|
easyrip/utils.py,sha256=N1rMF1MyoC-YFBgy10_u29cFoowfhR-5Viea93O7wQ4,8750
|
|
9
9
|
easyrip/easyrip_config/config.py,sha256=aj6Vg1rJkvICSTZ0ZONznR_MkvVr5u5ngkX_zfZopvU,9859
|
|
10
10
|
easyrip/easyrip_config/config_key.py,sha256=_jjdKOunskUoG7UUWOz3QZK-s4LF_x6hmM9MKttyS2Q,766
|
|
@@ -18,14 +18,14 @@ easyrip/easyrip_web/http_server.py,sha256=iyulCAFQrJlz86Lrr-Dm3fhOnNCf79Bp6fVHhr
|
|
|
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
20
|
easyrip/ripper/param.py,sha256=y1n2XaW55TJQ_r858pB4kYZVgT6TRpmS5vv9iMEIESc,11736
|
|
21
|
-
easyrip/ripper/ripper.py,sha256=
|
|
21
|
+
easyrip/ripper/ripper.py,sha256=xTwKpgkqqhh0x6J8DnE5fnXmEN_Q6ZZAdCPky68P-DE,50437
|
|
22
22
|
easyrip/ripper/sub_and_font/__init__.py,sha256=cBT7mxL7RRFaJXFPXuZ7RT-YK6FbnanaU5v6U9BOquw,153
|
|
23
|
-
easyrip/ripper/sub_and_font/ass.py,sha256=
|
|
23
|
+
easyrip/ripper/sub_and_font/ass.py,sha256=vQ_bP_-h2KHfSIYzqVpyRXG95m0f8jBYjFCc9X853-o,26419
|
|
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.
|
|
27
|
-
easyrip-4.
|
|
28
|
-
easyrip-4.
|
|
29
|
-
easyrip-4.
|
|
30
|
-
easyrip-4.
|
|
31
|
-
easyrip-4.
|
|
26
|
+
easyrip-4.10.0.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
|
|
27
|
+
easyrip-4.10.0.dist-info/METADATA,sha256=wWeHJfrBy8Lp2MHJhd4_x9bEYxmCr3ldaaabZkbkmgs,3507
|
|
28
|
+
easyrip-4.10.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
29
|
+
easyrip-4.10.0.dist-info/entry_points.txt,sha256=D6GBMMTzZ-apgX76KyZ6jxMmIFqGYwU9neeLLni_qKI,49
|
|
30
|
+
easyrip-4.10.0.dist-info/top_level.txt,sha256=kuEteBXm-Gf90jRQgH3-fTo-Z-Q6czSuUEqY158H4Ww,8
|
|
31
|
+
easyrip-4.10.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|