mirror of
https://github.com/truewhile/MeBox.git
synced 2026-10-07 22:06:38 +08:00
初始化
初始化项目
This commit is contained in:
@@ -23,47 +23,8 @@ func scanLibraryHandler(svc *service.Container) gin.HandlerFunc {
|
||||
return
|
||||
}
|
||||
if _, ok := service.ParseCloudLibraryMount(lib.Path); ok {
|
||||
status, started, startErr := svc.Scan.StartCloudLibraryScan(id, true)
|
||||
if startErr != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": startErr.Error()})
|
||||
return
|
||||
}
|
||||
if !started {
|
||||
c.JSON(http.StatusAccepted, gin.H{
|
||||
"library_id": id,
|
||||
"queued": true,
|
||||
"cloud": true,
|
||||
"already_running": true,
|
||||
"stage": status.Stage,
|
||||
"state": status.State,
|
||||
"message": "该云盘媒体库正在后台扫描,请在任务面板查看进度",
|
||||
"estimate_message": "页面关闭不会中断扫描",
|
||||
})
|
||||
return
|
||||
}
|
||||
task := startScanHTTPTask(svc, "云盘扫描队列", lib.Name, lib.Path)
|
||||
if svc.WSHub != nil {
|
||||
svc.WSHub.Publish("scan", gin.H{
|
||||
"library_id": id,
|
||||
"cloud": true,
|
||||
"queued": true,
|
||||
"stage": "queued",
|
||||
"message": "云盘扫描已加入后台队列,会递归扫描并自动加入媒体库",
|
||||
"estimate_message": "小目录通常几十秒;几万文件的大目录可能需要数分钟到数小时,取决于网盘接口速度",
|
||||
})
|
||||
}
|
||||
finishHTTPTask(task, nil, "queued", "云盘扫描已加入后台队列", map[string]int64{"queued": 1}, nil)
|
||||
c.JSON(http.StatusAccepted, gin.H{
|
||||
"library_id": id,
|
||||
"visited": 0,
|
||||
"added": 0,
|
||||
"updated": 0,
|
||||
"probed": 0,
|
||||
"queued": true,
|
||||
"cloud": true,
|
||||
"message": "云盘扫描已在后台运行,发现的媒体会自动加入当前媒体库;若已开启自动刮削,会在扫描后补齐元数据",
|
||||
"estimate_message": "小目录通常几十秒;几万文件的大目录可能需要数分钟到数小时,取决于网盘接口速度",
|
||||
})
|
||||
// 云盘扫描已随网盘后端移除;此处保留空分支以兼容既有客户端。
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": "cloud 网盘后端已移除,无法扫描云盘媒体库"})
|
||||
return
|
||||
}
|
||||
finishScan, ok := svc.Scan.TryBeginLocalScan(id)
|
||||
|
||||
Reference in New Issue
Block a user