From 8a52468bb7c0a31830ab3c2fd342fd39cbb55331 Mon Sep 17 00:00:00 2001 From: ngfchl Date: Thu, 13 Oct 2022 09:42:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8E=A8=E9=80=81=E5=88=B0?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E5=99=A8=E5=A4=B1=E8=B4=A5=E7=9A=84bug?= =?UTF-8?q?=EF=BC=8C=E4=BD=86=E6=8E=A8=E9=80=81=E6=97=A0=E5=8F=8D=E9=A6=88?= =?UTF-8?q?=EF=BC=8C=E7=9B=AE=E5=89=8D=E5=8F=AA=E8=83=BD=E8=87=AA=E8=A1=8C?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E6=98=AF=E5=90=A6=E6=88=90=E5=8A=9F=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pt_site/admin.py | 48 ++++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/pt_site/admin.py b/pt_site/admin.py index b74b3da..1dd1aa6 100644 --- a/pt_site/admin.py +++ b/pt_site/admin.py @@ -858,15 +858,15 @@ class TorrentInfoAdmin(AjaxAdmin): # instead of ModelAdmin torrent_info.state = True torrent_info.downloader = downloader torrent_info.save() - return JsonResponse(data={ - 'status': 'success', - 'msg': torrent_info.name + '推送成功!' - }) - else: - return JsonResponse(data={ - 'status': 'error', - 'msg': torrent_info.name + '推送失败!' - }) + # return JsonResponse(data={ + # 'status': 'success', + # 'msg': torrent_info.name + '推送成功!' + # }) + # else: + return JsonResponse(data={ + 'status': 'success', + 'msg': '推送结束!' + }) except Exception as e: # raise return JsonResponse(data={ @@ -909,7 +909,7 @@ class TorrentInfoAdmin(AjaxAdmin): # instead of ModelAdmin }) for torrent_info in queryset: print('创建种子标签', torrent_info.detail_url) - qb_client.torrents_create_category(torrent_info.detail_url) + # qb_client.torrents_create_category(torrent_info.detail_url) res = qb_client.torrents.add( # 种子链接 urls=torrent_info.magnet_url, @@ -919,21 +919,25 @@ class TorrentInfoAdmin(AjaxAdmin): # instead of ModelAdmin # 自动管理种子 use_auto_torrent_management=True, # 任务标签,用于和种子信息关联 - category=torrent_info.detail_url, + # category=torrent_info.detail_url, # 跳过HASH检查 # is_skip_checking=True ) print(res) - if res == 'Ok.': - print(torrent_info.magnet_url) - torrent = qb_client.torrents.info(category=torrent_info.detail_url) - print(len(torrent)) - torrent_info.hash_string = torrent[0].hash - torrent_info.save() - return JsonResponse(data={ - 'status': 'success', - 'msg': torrent_info.name + '推送成功!' - }) + # if res == 'Ok.': + # print(torrent_info.magnet_url) + # torrent = qb_client.torrents.info(category=torrent_info.detail_url) + # print(len(torrent)) + # torrent_info.hash_string = torrent[0].hash + # torrent_info.save() + # return JsonResponse(data={ + # 'status': 'success', + # 'msg': torrent_info.name + '推送成功!' + # }) + return JsonResponse(data={ + 'status': 'success', + 'msg': '推送结束!请自行检查是否推送成功!' + }) except Exception as e: return JsonResponse(data={ 'status': 'error', @@ -968,7 +972,7 @@ class TorrentInfoAdmin(AjaxAdmin): # instead of ModelAdmin # 这里指定对话框的标题 'title': '推送到下载器', # 提示信息 - 'tips': '仅支持推送到qBittorrent下载器!', + 'tips': '请自行检查是否种子是否推送成功!!', # 确认按钮显示文本 'confirm_button': '确认提交', # 取消按钮显示文本