- 将原有的单一api蓝图拆分为多个独立蓝图(torrent、book、music、file、video、image) - 每个蓝图负责对应的功能模块,实现更好的代码组织和维护性 - 更新应用初始化文件中的蓝图注册方式,使用新的模块化结构 - 修改前端API调用路径,将/files/rename调整为/file/rename - 在torrent服务中新增按名称查询功能和相关处理逻辑
23 lines
733 B
Python
23 lines
733 B
Python
from flask import Blueprint, jsonify
|
|
|
|
from app.services import TorrentService
|
|
|
|
bp = Blueprint("torrent", __name__)
|
|
|
|
|
|
@bp.route('/deduplication')
|
|
def torrent_deduplication():
|
|
torrent_object = TorrentService(["C:\\Users\\Localhost\\Desktop\\BT"])
|
|
return jsonify({"code": 200, "message": torrent_object.deduplication()})
|
|
|
|
|
|
@bp.route("/statistics")
|
|
def torrent_statistics():
|
|
torrent_object = TorrentService(["C:\\Users\\Localhost\\Desktop\\BT"])
|
|
return jsonify({"code": 200, "message": torrent_object.statistics()})
|
|
|
|
|
|
@bp.route("/s/<name>")
|
|
def torrent_by_name(name):
|
|
torrent_object = TorrentService(["C:\\Users\\Localhost\\Desktop\\BT"])
|
|
return jsonify({"code": 200, "message": torrent_object.get_by_name(name)}) |