add 打包发布

This commit is contained in:
2023-08-08 20:16:09 +08:00
parent b675e3033d
commit 007c76ccd3
4 changed files with 51 additions and 3 deletions

View File

@@ -44,9 +44,50 @@ async function getMediaState(vid){
// return true
}
/**
* 获取下载的ep开始与结束
* @param {string} vid 视频vid
* @returns {{start:string,end:string}} start开始集数end结束集数
*/
async function getDownEp(vid){
let sql = `select * from download where vid=? and state!=2`
let list = await getAll(sql,vid)
if(list.length == 0){
let sql = `select * from download where vid=? and state=1`
let list = await getAll(sql,vid)
let ep = []
for(let i of list){
ep.push(parseInt(i.title))
}
ep.sort((a,b)=>{
return a - b
})
return {
start: ep[0],
end:ep[ep.length - 1]
}
}else{
return false
}
}
/**
* 通过vid设置下载状态
* @param {string} vid 视频vid
* @param {number} state 状态
*/
async function setDownStateVid(vid,state){
let sql = `update download set state = ? where vid = ?`
await run(sql,state,vid)
}
module.exports = {
addDownList,
getDownList,
setDownState,
getMediaState
getMediaState,
getDownEp,
setDownStateVid
}

View File

@@ -42,6 +42,7 @@ async function getVideoInfo(sid){
}
}
module.exports = {
addSub,
getSub,