- 将原有的单一api蓝图拆分为多个独立蓝图(torrent、book、music、file、video、image) - 每个蓝图负责对应的功能模块,实现更好的代码组织和维护性 - 更新应用初始化文件中的蓝图注册方式,使用新的模块化结构 - 修改前端API调用路径,将/files/rename调整为/file/rename - 在torrent服务中新增按名称查询功能和相关处理逻辑
22 lines
539 B
Python
22 lines
539 B
Python
from flask import Blueprint, Response, jsonify
|
|
|
|
from app.services import ImageService, TorrentService
|
|
|
|
bp = Blueprint("image", __name__)
|
|
|
|
|
|
@bp.route("/export")
|
|
def image_export():
|
|
image_object = ImageService()
|
|
|
|
def generate():
|
|
yield from image_object.export()
|
|
|
|
return Response(generate(), mimetype='text/event-stream')
|
|
|
|
|
|
@bp.route("/hasTorrent")
|
|
def image_has_torrent():
|
|
torrent_obj = TorrentService(["C:\\Users\\Localhost\\Desktop\\Images"])
|
|
return jsonify({"code": 200, "message": torrent_obj.has_torrent()})
|