fix 获取ep
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user