easyrip 4.9.1__tar.gz → 4.10.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.9.1 → easyrip-4.10.0}/PKG-INFO +1 -1
  2. {easyrip-4.9.1 → easyrip-4.10.0}/easyrip/easyrip_log.py +0 -4
  3. {easyrip-4.9.1 → easyrip-4.10.0}/easyrip/global_val.py +1 -1
  4. {easyrip-4.9.1 → easyrip-4.10.0}/easyrip/ripper/ripper.py +2 -0
  5. {easyrip-4.9.1 → easyrip-4.10.0}/easyrip/ripper/sub_and_font/ass.py +131 -119
  6. {easyrip-4.9.1 → easyrip-4.10.0}/easyrip.egg-info/PKG-INFO +1 -1
  7. {easyrip-4.9.1 → easyrip-4.10.0}/LICENSE +0 -0
  8. {easyrip-4.9.1 → easyrip-4.10.0}/README.md +0 -0
  9. {easyrip-4.9.1 → easyrip-4.10.0}/easyrip/__init__.py +0 -0
  10. {easyrip-4.9.1 → easyrip-4.10.0}/easyrip/__main__.py +0 -0
  11. {easyrip-4.9.1 → easyrip-4.10.0}/easyrip/easyrip_command.py +0 -0
  12. {easyrip-4.9.1 → easyrip-4.10.0}/easyrip/easyrip_config/config.py +0 -0
  13. {easyrip-4.9.1 → easyrip-4.10.0}/easyrip/easyrip_config/config_key.py +0 -0
  14. {easyrip-4.9.1 → easyrip-4.10.0}/easyrip/easyrip_main.py +0 -0
  15. {easyrip-4.9.1 → easyrip-4.10.0}/easyrip/easyrip_mlang/__init__.py +0 -0
  16. {easyrip-4.9.1 → easyrip-4.10.0}/easyrip/easyrip_mlang/global_lang_val.py +0 -0
  17. {easyrip-4.9.1 → easyrip-4.10.0}/easyrip/easyrip_mlang/lang_en.py +0 -0
  18. {easyrip-4.9.1 → easyrip-4.10.0}/easyrip/easyrip_mlang/lang_zh_Hans_CN.py +0 -0
  19. {easyrip-4.9.1 → easyrip-4.10.0}/easyrip/easyrip_mlang/translator.py +0 -0
  20. {easyrip-4.9.1 → easyrip-4.10.0}/easyrip/easyrip_prompt.py +0 -0
  21. {easyrip-4.9.1 → easyrip-4.10.0}/easyrip/easyrip_web/__init__.py +0 -0
  22. {easyrip-4.9.1 → easyrip-4.10.0}/easyrip/easyrip_web/http_server.py +0 -0
  23. {easyrip-4.9.1 → easyrip-4.10.0}/easyrip/easyrip_web/third_party_api.py +0 -0
  24. {easyrip-4.9.1 → easyrip-4.10.0}/easyrip/ripper/media_info.py +0 -0
  25. {easyrip-4.9.1 → easyrip-4.10.0}/easyrip/ripper/param.py +0 -0
  26. {easyrip-4.9.1 → easyrip-4.10.0}/easyrip/ripper/sub_and_font/__init__.py +0 -0
  27. {easyrip-4.9.1 → easyrip-4.10.0}/easyrip/ripper/sub_and_font/font.py +0 -0
  28. {easyrip-4.9.1 → easyrip-4.10.0}/easyrip/ripper/sub_and_font/subset.py +0 -0
  29. {easyrip-4.9.1 → easyrip-4.10.0}/easyrip/utils.py +0 -0
  30. {easyrip-4.9.1 → easyrip-4.10.0}/easyrip.egg-info/SOURCES.txt +0 -0
  31. {easyrip-4.9.1 → easyrip-4.10.0}/easyrip.egg-info/dependency_links.txt +0 -0
  32. {easyrip-4.9.1 → easyrip-4.10.0}/easyrip.egg-info/entry_points.txt +0 -0
  33. {easyrip-4.9.1 → easyrip-4.10.0}/easyrip.egg-info/requires.txt +0 -0
  34. {easyrip-4.9.1 → easyrip-4.10.0}/easyrip.egg-info/top_level.txt +0 -0
  35. {easyrip-4.9.1 → easyrip-4.10.0}/pyproject.toml +0 -0
  36. {easyrip-4.9.1 → easyrip-4.10.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: easyrip
3
- Version: 4.9.1
3
+ Version: 4.10.0
4
4
  Author: op200
5
5
  License-Expression: AGPL-3.0-or-later
6
6
  Project-URL: Homepage, https://github.com/op200/EasyRip
@@ -397,8 +397,6 @@ class log:
397
397
  **fmt_kwargs,
398
398
  )
399
399
 
400
- warn = warning
401
-
402
400
  @classmethod
403
401
  def error(
404
402
  cls,
@@ -428,8 +426,6 @@ class log:
428
426
  **fmt_kwargs,
429
427
  )
430
428
 
431
- err = error
432
-
433
429
  @classmethod
434
430
  def send(
435
431
  cls,
@@ -3,7 +3,7 @@ import sys
3
3
  from pathlib import Path
4
4
 
5
5
  PROJECT_NAME = "Easy Rip"
6
- PROJECT_VERSION = "4.9.1"
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"
@@ -1081,6 +1081,8 @@ class Ripper:
1081
1081
  soft_sub_list = [Path(s) for s in soft_sub.split("?")]
1082
1082
 
1083
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")
1084
1086
  log.info("-soft-sub list = {}", soft_sub_list)
1085
1087
 
1086
1088
  # 临时翻译
@@ -63,7 +63,7 @@ class Script_info:
63
63
  class Style_data:
64
64
  Name: str
65
65
  Fontname: str
66
- Fontsize: int
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=int(style_tuple[self.fmt_index[Style_fmt_it.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
- if line.startswith("[") and line.endswith("]"):
617
- if new_unknown_data is not None:
618
- self.unknown_data.append(new_unknown_data)
619
- new_unknown_data = None
620
-
621
- match head := line[1:-1]:
622
- case "Script Info":
623
- state = State.script_info
624
- case "V4+ Styles":
625
- state = State.styles
626
- case "Fonts":
627
- state = State.fonts
628
- case "Graphics":
629
- state = State.graphics
630
- case "Events":
631
- state = State.events
632
- case _:
633
- if bool(re.search(r"[a-z]", head)):
634
- state = State.unknown
635
- new_unknown_data = Unknown_data(head=head)
636
-
637
- elif line.startswith("Format:"):
638
- formats_tuple = tuple(map(str.strip, line[7:].split(",")))
639
- match state:
640
- case State.styles:
641
- format_order = tuple(map(Style_fmt_it, formats_tuple))
642
- if len(format_order) != 23:
643
- raise Ass_generate_error("Style Format len != 23")
644
-
645
- self.styles.fmt_order = format_order
646
-
647
- case State.events:
648
- try:
649
- format_order = tuple(
650
- map(Event_fmt_it.__getitem__, formats_tuple)
651
- )
652
- except ValueError as e:
653
- raise Ass_generate_error from e
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
- if len(format_order) != 10:
656
- raise Ass_generate_error("Event Format len != 10")
656
+ if len(format_order) != 10:
657
+ raise Ass_generate_error("Event Format len != 10")
657
658
 
658
- if "Marked" in formats_tuple:
659
- log.error(
660
- "The ASS Events Format version too old: {}",
661
- "It used 'Marked' instead of 'Layer'. 'Marked' has been replaced with 'Layer', which will result in irreversible info loss",
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
- self.events.fmt_order = format_order
665
+ self.events.fmt_order = format_order
665
666
 
666
- else:
667
- match state:
668
- case State.script_info:
669
- self.script_info.data.append(Script_info_data(raw_str=line))
670
-
671
- case State.styles:
672
- if not line.startswith("Style:"):
673
- log.warning("Skip a Style line (illegal format): {}", line)
674
- continue
675
-
676
- style_tuple = tuple(map(str.strip, line[6:].split(",")))
677
- if len(style_tuple) != 23:
678
- log.warning(
679
- "Skip a Style line (Style Format len != 23): {}", line
680
- )
681
- continue
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
- self.styles.data.append(self.styles.new_data(style_tuple))
687
+ self.styles.data.append(self.styles.new_data(style_tuple))
684
688
 
685
- case State.graphics:
686
- if line.startswith("filename:"):
687
- self.attachments.data.append(
688
- Attachment_data(
689
- type=Attach_type.Graphics,
690
- name=line[9:].strip(),
691
- data="",
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
- self.attachments.data[-1].data += line + "\n"
699
-
700
- case State.fonts:
701
- if line.startswith("fontname:"):
702
- self.attachments.data.append(
703
- Attachment_data(
704
- type=Attach_type.Fonts,
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
- else:
710
- if self.attachments.data[-1].data is None:
711
- log.error("Unknown error", deep=True)
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
- self.attachments.data[-1].data += line + "\n"
714
-
715
- case State.events:
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
- self.events.data.append(
738
- self.events.new_data(event_tuple, event_type)
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
- case State.unknown:
742
- if new_unknown_data is None:
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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: easyrip
3
- Version: 4.9.1
3
+ Version: 4.10.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