fix 发种完成之后才进行下载

This commit is contained in:
theluyuan 2023-07-31 22:41:42 +08:00
parent 41464fc47b
commit 095ad565f5

View File

@ -87,6 +87,32 @@ async function reName(dinfo) {
} }
function dowv(dinfo){
return new Promise((res)=>{
dow(dinfo, async (msg, s) => {
console.log(String(msg))
if (s) {
let exist = fileIsExist(dinfo.save + "/" + dinfo.title + ".mp4")
if (exist) {
// 设置状态
let s = await reName(dinfo)
await setDownState(dinfo.id, s.state)
state = false
if (s.info) {
await sendSeed(s.info)
}
res(s)
} else {
// 重新下载
console.log("下载失败重新下载")
state = false
}
}
})
})
}
// 当前下载状态 // 当前下载状态
let state = false let state = false
async function CheckDown() { async function CheckDown() {
@ -98,25 +124,7 @@ async function CheckDown() {
state = true state = true
let dinfo = list[0] let dinfo = list[0]
mkdirRecursions(dinfo.save) mkdirRecursions(dinfo.save)
dow(dinfo, async (msg, s) => { await dowv(dinfo)
console.log(String(msg))
if (s) {
let exist = fileIsExist(dinfo.save + "/" + dinfo.title + ".mp4")
if (exist) {
// 设置状态
let s = await reName(dinfo)
await setDownState(dinfo.id, s.state)
state = false
if (s.info) {
sendSeed(s.info)
}
} else {
// 重新下载
console.log("下载失败重新下载")
state = false
}
}
})
} }
} }