diff --git a/auto_pt/views.py b/auto_pt/views.py index 7cab239..5888db6 100644 --- a/auto_pt/views.py +++ b/auto_pt/views.py @@ -12,7 +12,7 @@ from django.shortcuts import render from pt_site import views as tasks from pt_site.models import SiteStatus, MySite, Site, Downloader from pt_site.views import scheduler, pt_spider -from ptools.base import CommonResponse, StatusCodeEnum +from ptools.base import CommonResponse, StatusCodeEnum, DownloaderCategory def add_task(request): @@ -87,7 +87,7 @@ def page_downloading(request): def get_downloader(request): - downloader_list = Downloader.objects.values('id', 'name', 'host') + downloader_list = Downloader.objects.filter(category=DownloaderCategory.qBittorrent).values('id', 'name', 'host') return JsonResponse(CommonResponse.success(data=list(downloader_list)).to_dict(), safe=False) @@ -96,19 +96,17 @@ def get_downloading(request): print(id) downloader = Downloader.objects.filter(id=id).first() - qb_client = qbittorrentapi.Client(host=downloader.host, - port=downloader.port, - username=downloader.username, - password=downloader.password) + qb_client = qbittorrentapi.Client( + host=downloader.host, + port=downloader.port, + username=downloader.username, + password=downloader.password, + SIMPLE_RESPONSES=True + ) try: qb_client.auth_log_in() - t_list = qb_client.torrents_info() - print(len(t_list)) - torrents = [] - for torrent in t_list: - # torrent.to_dict() - torrents.append(dict(torrent)) - print(torrents) + torrents = qb_client.torrents_info() + print(len(torrents)) return JsonResponse(CommonResponse.success(data=torrents).to_dict(), safe=False) except Exception as e: print(e) diff --git a/templates/auto_pt/downloading.html b/templates/auto_pt/downloading.html index d81dab8..8676c6d 100644 --- a/templates/auto_pt/downloading.html +++ b/templates/auto_pt/downloading.html @@ -17,23 +17,23 @@ {# :name="downloader.id"#} :id="downloader.id"> - - 操作 - - - 继续 - 暂停 - 强制继续 - 删除 - 限速 - 分类 - 更改路径 - 自动管理 - 重新校验 - 复制链接 - 复制HASH - - + + 操作 + + + 继续 + 暂停 + 强制继续 + 删除 + 限速 + 分类 + 更改路径 + 自动管理 + 重新校验 + 复制链接 + 复制HASH + + - #} @@ -94,118 +94,180 @@ {# label="Tracker">#} - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {% include 'admin/includes/js-part.html' %} \ No newline at end of file