jmcomic 2.6.3__py3-none-any.whl → 2.6.4__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.
jmcomic/__init__.py CHANGED
@@ -2,7 +2,7 @@
2
2
  # 被依赖方 <--- 使用方
3
3
  # config <--- entity <--- toolkit <--- client <--- option <--- downloader
4
4
 
5
- __version__ = '2.6.3'
5
+ __version__ = '2.6.4'
6
6
 
7
7
  from .api import *
8
8
  from .jm_plugin import *
jmcomic/jm_entity.py CHANGED
@@ -469,11 +469,13 @@ class JmAlbumDetail(DetailEntity, Downloadable):
469
469
  authors,
470
470
  tags,
471
471
  related_list=None,
472
+ description='',
472
473
  ):
473
474
  super().__init__()
474
475
  self.album_id: str = str(album_id)
475
476
  self.scramble_id: str = str(scramble_id)
476
477
  self.name: str = str(name).strip()
478
+ self.description = str(description).strip()
477
479
  self.page_count: int = int(page_count) # 总页数
478
480
  self.pub_date: str = pub_date # 发布日期
479
481
  self.update_date: str = update_date # 更新日期
jmcomic/jm_plugin.py CHANGED
@@ -749,6 +749,7 @@ class Img2pdfPlugin(JmOptionPlugin):
749
749
  filename_rule='Pid',
750
750
  dir_rule=None,
751
751
  delete_original_file=False,
752
+ encrypt=None,
752
753
  **kwargs,
753
754
  ):
754
755
  if photo is None and album is None:
@@ -766,14 +767,14 @@ class Img2pdfPlugin(JmOptionPlugin):
766
767
  pdf_filepath = self.decide_filepath(album, photo, filename_rule, 'pdf', pdf_dir, dir_rule)
767
768
 
768
769
  # 调用 img2pdf 把 photo_dir 下的所有图片转为pdf
769
- img_path_ls, img_dir_ls = self.write_img_2_pdf(pdf_filepath, album, photo)
770
+ img_path_ls, img_dir_ls = self.write_img_2_pdf(pdf_filepath, album, photo, encrypt)
770
771
  self.log(f'Convert Successfully: JM{album or photo} → {pdf_filepath}')
771
772
 
772
773
  # 执行删除
773
774
  img_path_ls += img_dir_ls
774
775
  self.execute_deletion(img_path_ls)
775
776
 
776
- def write_img_2_pdf(self, pdf_filepath, album: JmAlbumDetail, photo: JmPhotoDetail):
777
+ def write_img_2_pdf(self, pdf_filepath, album: JmAlbumDetail, photo: JmPhotoDetail, encrypt):
777
778
  import img2pdf
778
779
 
779
780
  if album is None:
@@ -795,8 +796,22 @@ class Img2pdfPlugin(JmOptionPlugin):
795
796
  with open(pdf_filepath, 'wb') as f:
796
797
  f.write(img2pdf.convert(img_path_ls))
797
798
 
799
+ if encrypt:
800
+ self.encrypt_pdf(pdf_filepath, encrypt)
801
+
798
802
  return img_path_ls, img_dir_ls
799
803
 
804
+ def encrypt_pdf(self, pdf_filepath: str, encrypt: dict):
805
+ try:
806
+ import pikepdf
807
+ except ImportError:
808
+ self.warning_lib_not_install('pikepdf')
809
+ return
810
+
811
+ password = str(encrypt.get('password', ''))
812
+ with pikepdf.open(pdf_filepath, allow_overwriting_input=True) as pdf:
813
+ pdf.save(pdf_filepath, encryption=pikepdf.Encryption(user=password, owner=password))
814
+
800
815
 
801
816
  class LongImgPlugin(JmOptionPlugin):
802
817
  plugin_key = 'long_img'
jmcomic/jm_toolkit.py CHANGED
@@ -26,6 +26,7 @@ class JmcomicText:
26
26
  pattern_html_album_album_id = compile(r'<span class="number">.*?:JM(\d+)</span>')
27
27
  pattern_html_album_scramble_id = compile(r'var scramble_id = (\d+);')
28
28
  pattern_html_album_name = compile(r'id="book-name"[^>]*?>([\s\S]*?)<')
29
+ pattern_html_album_description = compile(r'叙述:([\s\S]*?)</h2>')
29
30
  pattern_html_album_episode_list = compile(r'data-album="(\d+)"[^>]*>[\s\S]*?第(\d+)[话話]([\s\S]*?)<[\s\S]*?>')
30
31
  pattern_html_album_page_count = compile(r'<span class="pagecount">.*?:(\d+)</span>')
31
32
  pattern_html_album_pub_date = compile(r'>上架日期 : (.*?)</span>')
@@ -651,6 +652,7 @@ class JmApiAdaptTool:
651
652
  'actors',
652
653
  'related_list',
653
654
  'name',
655
+ 'description',
654
656
  ('id', 'album_id'),
655
657
  ('author', 'authors'),
656
658
  ('total_views', 'views'),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jmcomic
3
- Version: 2.6.3
3
+ Version: 2.6.4
4
4
  Summary: Python API For JMComic (禁漫天堂)
5
5
  Home-page: https://github.com/hect0x7/JMComic-Crawler-Python
6
6
  Author: hect0x7
@@ -1,18 +1,18 @@
1
- jmcomic/__init__.py,sha256=BWvK4hjc2jPXlu3FiAnVV5bJ7r42Vc7eqfa97sM4msU,902
1
+ jmcomic/__init__.py,sha256=bLTPD0DrRiCYtTpHwL3G2ApUxkkeAlo4MUb-jCT4Oso,902
2
2
  jmcomic/api.py,sha256=ZduhXDmh4lg1dkXHs7UTAaPpYNO7kcdPCDH5JJT9KSI,4253
3
3
  jmcomic/cl.py,sha256=PBSh0JndNFZw3B7WJPj5Y8SeFdKzHE00jIwYo9An-K0,3475
4
4
  jmcomic/jm_client_impl.py,sha256=huPWXkEizu8x7J4rAk_iQROnXphPoyadXyvN8n1ENqI,41624
5
5
  jmcomic/jm_client_interface.py,sha256=Bld80cYwBwIqcMSJK09g5q8U_UX3IWnQJxuRJQwmIOk,19082
6
6
  jmcomic/jm_config.py,sha256=gyqvsm62Cr61-CNLAC1KBiIfdEzKJhJPAkRa6ZyuXOk,17144
7
7
  jmcomic/jm_downloader.py,sha256=azYkIN-1OuEivZ1TGGDaYo1FkcO5KatSb0g4GVdKSPY,11041
8
- jmcomic/jm_entity.py,sha256=x-3yUvM74C_Gof20mJw2SmZq7sSSsGNg0Cp47oZ-dFg,19968
8
+ jmcomic/jm_entity.py,sha256=ZyXVy3mOl9qkxlw6hyshVS3RR-yKfO5BkJHtyBAoKQE,20053
9
9
  jmcomic/jm_exception.py,sha256=x3KGMLlQS2zi1GX7z5G58zJN2EwLkI4mAURkxZYjEvA,5055
10
10
  jmcomic/jm_option.py,sha256=kErkn9-tXYp4h4lDQvc8jDYG1vqOMLIdIb3fbHvSsbA,21247
11
- jmcomic/jm_plugin.py,sha256=M-f7xty_90d3mSYmzrXSpYdua-KEBQVzGcWip1OA5gc,40345
12
- jmcomic/jm_toolkit.py,sha256=C5z7ddhacDW-WgOm-ruPshxModKwDPUczdUjUdEI9CQ,29582
13
- jmcomic-2.6.3.dist-info/licenses/LICENSE,sha256=kz4coTxZxuGxisK3W00tjK57Zh3RcMGq-EnbXrK7-xA,1064
14
- jmcomic-2.6.3.dist-info/METADATA,sha256=wCnWgIAvJGAPm3_DL3xGUcFe-6gCma5ymlao55dGV4Y,9572
15
- jmcomic-2.6.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
- jmcomic-2.6.3.dist-info/entry_points.txt,sha256=tRbQltaGSBjejI0c9jYt-4SXQMd5nSDHcMvHmuTy4ow,44
17
- jmcomic-2.6.3.dist-info/top_level.txt,sha256=puvVMFYJqIbd6NOTMEvOyugMTT8woBfSQyxEBan3zY4,8
18
- jmcomic-2.6.3.dist-info/RECORD,,
11
+ jmcomic/jm_plugin.py,sha256=x42eqhRcnHElTif8ORXw2jZh33Xnq55-1dpC6tmr_lQ,40894
12
+ jmcomic/jm_toolkit.py,sha256=SIYCRZ6P4SPbAQA03U5z2DNiDldY7hWsAvKTdEzyK9U,29683
13
+ jmcomic-2.6.4.dist-info/licenses/LICENSE,sha256=kz4coTxZxuGxisK3W00tjK57Zh3RcMGq-EnbXrK7-xA,1064
14
+ jmcomic-2.6.4.dist-info/METADATA,sha256=y8uFHhQIpHE7EWvNcQ-QVvCPv6EV4lZkry8ZXCg7Uuo,9572
15
+ jmcomic-2.6.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
+ jmcomic-2.6.4.dist-info/entry_points.txt,sha256=tRbQltaGSBjejI0c9jYt-4SXQMd5nSDHcMvHmuTy4ow,44
17
+ jmcomic-2.6.4.dist-info/top_level.txt,sha256=puvVMFYJqIbd6NOTMEvOyugMTT8woBfSQyxEBan3zY4,8
18
+ jmcomic-2.6.4.dist-info/RECORD,,