fix 获取ep
This commit is contained in:
parent
007c76ccd3
commit
01308db3cf
3
index.js
3
index.js
@ -20,7 +20,7 @@ app.use(async (ctx, next) => {
|
||||
const index = require("./router/index.js")
|
||||
app.use(index.routes()).use(index.allowedMethods())
|
||||
const videoInfo = require("./router/videoInfo.js");
|
||||
const config = require("./router/config.js")
|
||||
const config = require("./router/config.js");
|
||||
|
||||
app.use(config.routes()).use(config.allowedMethods())
|
||||
app.use(videoInfo.routes()).use(videoInfo.allowedMethods())
|
||||
@ -28,4 +28,3 @@ app.listen(3050, "0.0.0.0");
|
||||
|
||||
// 引入定时检测更新
|
||||
require("./util/Video/Update.js")
|
||||
console.log("link: http://127.0.0.1:3050")
|
@ -1,5 +1,5 @@
|
||||
const fs = require("fs")
|
||||
const { getMediaState, getDownEp } = require("../sql/download.js");
|
||||
const { getMediaState, getDownEp, setDownStateVid } = require("../sql/download.js");
|
||||
const path = require("path");
|
||||
const { cwd } = require("process");
|
||||
const { createTorrent, getVideoSpecifyTimeImage, uploadImg, getMediaInfoSend, deleteFolder, moveDir } = require("../utils.js");
|
||||
@ -17,11 +17,13 @@ async function updateSeed(info, desc) {
|
||||
let form = new FormData()
|
||||
form.append('file', fs.createReadStream(path.join(cwd(), "/tmp/torrent/" + info.seedName.replace(" ",".") + ".torrent")))
|
||||
let ep = await getDownEp(info.vid)
|
||||
console.log(ep)
|
||||
if(ep.start == ep.end){
|
||||
form.append("name", info.title.replace("Epxxx", "E" + info.ep))
|
||||
}else{
|
||||
form.append("name", info.title.replace("Epxxx", "E" + ep.start + "-" + "E" + ep.end))
|
||||
}
|
||||
await setDownStateVid(info.vid,2)
|
||||
form.append("small_descr", vinfo.subtitle)
|
||||
form.append("url", vinfo.imdb)
|
||||
form.append("descr", desc)
|
||||
|
@ -51,8 +51,9 @@ async function getMediaState(vid){
|
||||
* @returns {{start:string,end:string}} start开始集数,end结束集数
|
||||
*/
|
||||
async function getDownEp(vid){
|
||||
let sql = `select * from download where vid=? and state!=2`
|
||||
let sql = `select * from download where vid=? and (state=3 OR state=0)`
|
||||
let list = await getAll(sql,vid)
|
||||
console.log(vid,list)
|
||||
if(list.length == 0){
|
||||
let sql = `select * from download where vid=? and state=1`
|
||||
let list = await getAll(sql,vid)
|
||||
|
Loading…
Reference in New Issue
Block a user