refactor(api): 重构API蓝图结构按功能模块拆分
- 将原有的单一api蓝图拆分为多个独立蓝图(torrent、book、music、file、video、image) - 每个蓝图负责对应的功能模块,实现更好的代码组织和维护性 - 更新应用初始化文件中的蓝图注册方式,使用新的模块化结构 - 修改前端API调用路径,将/files/rename调整为/file/rename - 在torrent服务中新增按名称查询功能和相关处理逻辑
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
from flask import Blueprint, jsonify
|
||||
|
||||
from app.services import VideoService, TorrentService
|
||||
|
||||
bp = Blueprint("video", __name__)
|
||||
|
||||
@bp.route("/findDeduplication")
|
||||
def video_find_deduplication():
|
||||
video_object = VideoService(paths=[
|
||||
"C:\\迅雷下载\\0_done",
|
||||
"D:\\",
|
||||
"E:\\",
|
||||
"F:\\"
|
||||
])
|
||||
|
||||
return jsonify({"code": 200, "message": video_object.find_deduplication()})
|
||||
|
||||
|
||||
@bp.route('/deduplication')
|
||||
def video_deduplication():
|
||||
video_object = VideoService(paths=[
|
||||
"C:\\迅雷下载\\0_done",
|
||||
"D:\\",
|
||||
"E:\\",
|
||||
"F:\\"
|
||||
])
|
||||
|
||||
return jsonify({"code": 200, "message": video_object.deduplication()})
|
||||
|
||||
|
||||
@bp.route("/hasTorrent")
|
||||
def video_has_torrent():
|
||||
torrent_obj = TorrentService(["E:\\"])
|
||||
return jsonify({"code": 200, "message": torrent_obj.has_torrent()})
|
||||
Reference in New Issue
Block a user