jmcomic 2.5.10__tar.gz → 2.5.11__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.
- {jmcomic-2.5.10/src/jmcomic.egg-info → jmcomic-2.5.11}/PKG-INFO +1 -1
- {jmcomic-2.5.10 → jmcomic-2.5.11}/src/jmcomic/__init__.py +1 -1
- {jmcomic-2.5.10 → jmcomic-2.5.11}/src/jmcomic/jm_client_interface.py +12 -0
- {jmcomic-2.5.10 → jmcomic-2.5.11}/src/jmcomic/jm_plugin.py +43 -0
- {jmcomic-2.5.10 → jmcomic-2.5.11/src/jmcomic.egg-info}/PKG-INFO +1 -1
- {jmcomic-2.5.10 → jmcomic-2.5.11}/LICENSE +0 -0
- {jmcomic-2.5.10 → jmcomic-2.5.11}/README.md +0 -0
- {jmcomic-2.5.10 → jmcomic-2.5.11}/setup.cfg +0 -0
- {jmcomic-2.5.10 → jmcomic-2.5.11}/setup.py +0 -0
- {jmcomic-2.5.10 → jmcomic-2.5.11}/src/jmcomic/api.py +0 -0
- {jmcomic-2.5.10 → jmcomic-2.5.11}/src/jmcomic/cl.py +0 -0
- {jmcomic-2.5.10 → jmcomic-2.5.11}/src/jmcomic/jm_client_impl.py +0 -0
- {jmcomic-2.5.10 → jmcomic-2.5.11}/src/jmcomic/jm_config.py +0 -0
- {jmcomic-2.5.10 → jmcomic-2.5.11}/src/jmcomic/jm_downloader.py +0 -0
- {jmcomic-2.5.10 → jmcomic-2.5.11}/src/jmcomic/jm_entity.py +0 -0
- {jmcomic-2.5.10 → jmcomic-2.5.11}/src/jmcomic/jm_exception.py +0 -0
- {jmcomic-2.5.10 → jmcomic-2.5.11}/src/jmcomic/jm_option.py +0 -0
- {jmcomic-2.5.10 → jmcomic-2.5.11}/src/jmcomic/jm_toolkit.py +0 -0
- {jmcomic-2.5.10 → jmcomic-2.5.11}/src/jmcomic.egg-info/SOURCES.txt +0 -0
- {jmcomic-2.5.10 → jmcomic-2.5.11}/src/jmcomic.egg-info/dependency_links.txt +0 -0
- {jmcomic-2.5.10 → jmcomic-2.5.11}/src/jmcomic.egg-info/entry_points.txt +0 -0
- {jmcomic-2.5.10 → jmcomic-2.5.11}/src/jmcomic.egg-info/requires.txt +0 -0
- {jmcomic-2.5.10 → jmcomic-2.5.11}/src/jmcomic.egg-info/top_level.txt +0 -0
|
@@ -572,3 +572,15 @@ class JmcomicClient(
|
|
|
572
572
|
}
|
|
573
573
|
|
|
574
574
|
yield from self.do_page_iter(params, page, self.categories_filter)
|
|
575
|
+
|
|
576
|
+
def is_given_type(self, ctype: Type['JmcomicClient']) -> bool:
|
|
577
|
+
"""
|
|
578
|
+
Client代理的此方法会被路由到内部client的方法
|
|
579
|
+
即:ClientProxy(AClient()).is_given_type(AClient) is True
|
|
580
|
+
但是: ClientProxy(AClient()).client_key != AClient.client_key
|
|
581
|
+
"""
|
|
582
|
+
if isinstance(self, ctype):
|
|
583
|
+
return True
|
|
584
|
+
if self.client_key == instance.client_key:
|
|
585
|
+
return True
|
|
586
|
+
return False
|
|
@@ -757,6 +757,49 @@ class ConvertJpgToPdfPlugin(JmOptionPlugin):
|
|
|
757
757
|
self.execute_deletion(paths)
|
|
758
758
|
|
|
759
759
|
|
|
760
|
+
class Img2pdfPlugin(JmOptionPlugin):
|
|
761
|
+
plugin_key = 'img2pdf'
|
|
762
|
+
|
|
763
|
+
def invoke(self,
|
|
764
|
+
photo: JmPhotoDetail,
|
|
765
|
+
downloader=None,
|
|
766
|
+
pdf_dir=None,
|
|
767
|
+
filename_rule='Pid',
|
|
768
|
+
delete_original_file=False,
|
|
769
|
+
**kwargs,
|
|
770
|
+
):
|
|
771
|
+
try:
|
|
772
|
+
import img2pdf
|
|
773
|
+
except ImportError:
|
|
774
|
+
self.warning_lib_not_install('img2pdf')
|
|
775
|
+
return
|
|
776
|
+
|
|
777
|
+
self.delete_original_file = delete_original_file
|
|
778
|
+
|
|
779
|
+
# 处理文件夹配置
|
|
780
|
+
filename = DirRule.apply_rule_directly(None, photo, filename_rule)
|
|
781
|
+
photo_dir = self.option.decide_image_save_dir(photo)
|
|
782
|
+
|
|
783
|
+
# 处理生成的pdf文件的路径
|
|
784
|
+
if pdf_dir is None:
|
|
785
|
+
pdf_dir = photo_dir
|
|
786
|
+
else:
|
|
787
|
+
pdf_dir = fix_filepath(pdf_dir, True)
|
|
788
|
+
mkdir_if_not_exists(pdf_dir)
|
|
789
|
+
|
|
790
|
+
pdf_filepath = os.path.join(pdf_dir, f'{filename}.pdf')
|
|
791
|
+
|
|
792
|
+
# 调用 img2pdf 把 photo_dir 下的所有图片转为pdf
|
|
793
|
+
all_img = files_of_dir(photo_dir)
|
|
794
|
+
with open(pdf_filepath, 'wb') as f:
|
|
795
|
+
f.write(img2pdf.convert(all_img))
|
|
796
|
+
|
|
797
|
+
# 执行删除
|
|
798
|
+
self.log(f'Convert Successfully: JM{photo.id} → {pdf_filepath}')
|
|
799
|
+
all_img.append(self.option.decide_image_save_dir(photo, ensure_exists=False))
|
|
800
|
+
self.execute_deletion(all_img)
|
|
801
|
+
|
|
802
|
+
|
|
760
803
|
class JmServerPlugin(JmOptionPlugin):
|
|
761
804
|
plugin_key = 'jm_server'
|
|
762
805
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|