nonebot-plugin-jmdownloader 1.0.1__tar.gz → 1.0.2__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 (14) hide show
  1. {nonebot_plugin_jmdownloader-1.0.1 → nonebot_plugin_jmdownloader-1.0.2}/PKG-INFO +2 -2
  2. {nonebot_plugin_jmdownloader-1.0.1 → nonebot_plugin_jmdownloader-1.0.2}/nonebot_plugin_jmdownloader/__init__.py +21 -17
  3. {nonebot_plugin_jmdownloader-1.0.1 → nonebot_plugin_jmdownloader-1.0.2}/nonebot_plugin_jmdownloader/utils.py +4 -4
  4. {nonebot_plugin_jmdownloader-1.0.1 → nonebot_plugin_jmdownloader-1.0.2}/nonebot_plugin_jmdownloader.egg-info/PKG-INFO +2 -2
  5. {nonebot_plugin_jmdownloader-1.0.1 → nonebot_plugin_jmdownloader-1.0.2}/nonebot_plugin_jmdownloader.egg-info/requires.txt +1 -1
  6. {nonebot_plugin_jmdownloader-1.0.1 → nonebot_plugin_jmdownloader-1.0.2}/pyproject.toml +2 -2
  7. {nonebot_plugin_jmdownloader-1.0.1 → nonebot_plugin_jmdownloader-1.0.2}/LICENSE +0 -0
  8. {nonebot_plugin_jmdownloader-1.0.1 → nonebot_plugin_jmdownloader-1.0.2}/README.md +0 -0
  9. {nonebot_plugin_jmdownloader-1.0.1 → nonebot_plugin_jmdownloader-1.0.2}/nonebot_plugin_jmdownloader/config.py +0 -0
  10. {nonebot_plugin_jmdownloader-1.0.1 → nonebot_plugin_jmdownloader-1.0.2}/nonebot_plugin_jmdownloader/data_source.py +0 -0
  11. {nonebot_plugin_jmdownloader-1.0.1 → nonebot_plugin_jmdownloader-1.0.2}/nonebot_plugin_jmdownloader.egg-info/SOURCES.txt +0 -0
  12. {nonebot_plugin_jmdownloader-1.0.1 → nonebot_plugin_jmdownloader-1.0.2}/nonebot_plugin_jmdownloader.egg-info/dependency_links.txt +0 -0
  13. {nonebot_plugin_jmdownloader-1.0.1 → nonebot_plugin_jmdownloader-1.0.2}/nonebot_plugin_jmdownloader.egg-info/top_level.txt +0 -0
  14. {nonebot_plugin_jmdownloader-1.0.1 → nonebot_plugin_jmdownloader-1.0.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nonebot-plugin-jmdownloader
3
- Version: 1.0.1
3
+ Version: 1.0.2
4
4
  Summary: 基于 Nonebot2 的 JMComic 插件
5
5
  Author-email: Misty02600 <xiao02600@gmail.com>
6
6
  Project-URL: Repository, https://github.com/Misty02600/nonebot-plugin-jmdownloader
@@ -15,7 +15,7 @@ Requires-Dist: nonebot-plugin-waiter<1.0.0,>=0.8.1
15
15
  Requires-Dist: nonebot-plugin-localstore<1.0.0,>=0.7.4
16
16
  Requires-Dist: nonebot-plugin-apscheduler<1.0.0,>=0.5.0
17
17
  Requires-Dist: nonebot-adapter-onebot<3.0.0,>=2.4.6
18
- Requires-Dist: jmcomic>=2.5.33
18
+ Requires-Dist: jmcomic>=2.5.35
19
19
  Requires-Dist: pillow>=11.1.0
20
20
  Requires-Dist: img2pdf>=0.6.0
21
21
  Dynamic: license-file
@@ -2,6 +2,7 @@ import asyncio
2
2
  import hashlib
3
3
  import os
4
4
  import random
5
+ from re import A
5
6
  import shutil
6
7
  import time
7
8
 
@@ -88,29 +89,32 @@ async def _(bot: Bot, event: MessageEvent, arg: Message = CommandArg()):
88
89
  else:
89
90
  await jm_download.finish("该本子(或其tag)被禁止下载!")
90
91
 
91
- if str(user_id) not in bot.config.superusers:
92
- data_manager.decrease_user_limit(user_id, 1)
93
- user_limit_new = data_manager.get_user_limit(user_id)
94
- message = Message()
95
- message += f"jm{photo.id} | {photo.title}\n"
96
- message += f"🎨 作者: {photo.author}\n"
97
- message += "🔖 标签: " + " ".join(f"#{tag}" for tag in photo.tags) + "\n"
98
- message += f"开始下载...\n你本周还有{user_limit_new}次下载次数!"
99
- await jm_download.send(message)
100
- else:
101
- message = Message()
102
- message += f"jm{photo.id} | {photo.title}\n"
103
- message += f"🎨 作者: {photo.author}\n"
104
- message += "🔖 标签: " + " ".join(f"#{tag}" for tag in photo.tags) + "\n"
105
- message += "开始下载..."
106
- await jm_download.send(message)
92
+ try:
93
+ if str(user_id) not in bot.config.superusers:
94
+ data_manager.decrease_user_limit(user_id, 1)
95
+ user_limit_new = data_manager.get_user_limit(user_id)
96
+ message = Message()
97
+ message += f"jm{photo.id} | {photo.title}\n"
98
+ message += f"🎨 作者: {photo.author}\n"
99
+ message += "🔖 标签: " + " ".join(f"#{tag}" for tag in photo.tags) + "\n"
100
+ message += f"开始下载...\n你本周还有{user_limit_new}次下载次数!"
101
+ await jm_download.send(message)
102
+ else:
103
+ message = Message()
104
+ message += f"jm{photo.id} | {photo.title}\n"
105
+ message += f"🎨 作者: {photo.author}\n"
106
+ message += "🔖 标签: " + " ".join(f"#{tag}" for tag in photo.tags) + "\n"
107
+ message += "开始下载..."
108
+ await jm_download.send(message)
109
+ except ActionFailed:
110
+ await jm_download.send("本子信息可能被屏蔽,已开始下载")
107
111
 
108
112
  try:
109
113
  pdf_path = f"{cache_dir}/{photo.id}.pdf"
110
114
 
111
115
  # 如果不存在,则下载
112
116
  if not os.path.exists(pdf_path):
113
- if not await download_photo_async(client, downloader, photo):
117
+ if not await download_photo_async(downloader, photo):
114
118
  await jm_download.finish("下载失败")
115
119
 
116
120
  # 根据配置决定是否需要修改MD5
@@ -43,17 +43,17 @@ async def get_photo_info_async(client: JmcomicClient, photo_id):
43
43
  return await asyncio.to_thread(get_photo_info, client, photo_id)
44
44
 
45
45
 
46
- def download_photo(client: JmcomicClient, downloader: JmDownloader, photo: JmPhotoDetail):
46
+ def download_photo(downloader: JmDownloader, photo: JmPhotoDetail):
47
47
  try:
48
48
  with downloader as dler:
49
- dler.download_by_photo_detail(photo, client)
49
+ dler.download_by_photo_detail(photo)
50
50
  return True
51
51
  except JmcomicException as e:
52
52
  logger.error(f"JMComic 下载失败: {e}")
53
53
  return False
54
54
 
55
- async def download_photo_async(client: JmcomicClient, downloader: JmDownloader, photo: JmPhotoDetail):
56
- return await asyncio.to_thread(download_photo, client, downloader, photo)
55
+ async def download_photo_async(downloader: JmDownloader, photo: JmPhotoDetail):
56
+ return await asyncio.to_thread(download_photo, downloader, photo)
57
57
 
58
58
 
59
59
  def search_album(client: JmcomicClient, search_query: str, page: int = 1):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nonebot-plugin-jmdownloader
3
- Version: 1.0.1
3
+ Version: 1.0.2
4
4
  Summary: 基于 Nonebot2 的 JMComic 插件
5
5
  Author-email: Misty02600 <xiao02600@gmail.com>
6
6
  Project-URL: Repository, https://github.com/Misty02600/nonebot-plugin-jmdownloader
@@ -15,7 +15,7 @@ Requires-Dist: nonebot-plugin-waiter<1.0.0,>=0.8.1
15
15
  Requires-Dist: nonebot-plugin-localstore<1.0.0,>=0.7.4
16
16
  Requires-Dist: nonebot-plugin-apscheduler<1.0.0,>=0.5.0
17
17
  Requires-Dist: nonebot-adapter-onebot<3.0.0,>=2.4.6
18
- Requires-Dist: jmcomic>=2.5.33
18
+ Requires-Dist: jmcomic>=2.5.35
19
19
  Requires-Dist: pillow>=11.1.0
20
20
  Requires-Dist: img2pdf>=0.6.0
21
21
  Dynamic: license-file
@@ -6,6 +6,6 @@ nonebot-plugin-waiter<1.0.0,>=0.8.1
6
6
  nonebot-plugin-localstore<1.0.0,>=0.7.4
7
7
  nonebot-plugin-apscheduler<1.0.0,>=0.5.0
8
8
  nonebot-adapter-onebot<3.0.0,>=2.4.6
9
- jmcomic>=2.5.33
9
+ jmcomic>=2.5.35
10
10
  pillow>=11.1.0
11
11
  img2pdf>=0.6.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "nonebot-plugin-jmdownloader"
3
- version = "1.0.1"
3
+ version = "1.0.2"
4
4
  description = "基于 Nonebot2 的 JMComic 插件"
5
5
  readme = "README.md"
6
6
  authors = [{ name = "Misty02600", email = "xiao02600@gmail.com" }]
@@ -15,7 +15,7 @@ dependencies = [
15
15
  "nonebot-plugin-localstore>=0.7.4,<1.0.0",
16
16
  "nonebot-plugin-apscheduler>=0.5.0,<1.0.0",
17
17
  "nonebot-adapter-onebot>=2.4.6,<3.0.0",
18
- "jmcomic>=2.5.33",
18
+ "jmcomic>=2.5.35",
19
19
  "pillow>=11.1.0",
20
20
  "img2pdf>=0.6.0",
21
21
  ]