add 种子制作
This commit is contained in:
35
util/SendSeed/index.js
Normal file
35
util/SendSeed/index.js
Normal file
@@ -0,0 +1,35 @@
|
||||
const fs = require("fs")
|
||||
const { getMediaState } = require("../sql/download.js");
|
||||
const path = require("path");
|
||||
const { cwd } = require("process");
|
||||
const { createTorrent, getVideoSpecifyTimeImage } = require("../utils.js");
|
||||
|
||||
async function updateSeed(){
|
||||
|
||||
}
|
||||
|
||||
async function sendSeed(info){
|
||||
console.log(info)
|
||||
let state = await getMediaState(info.vid)
|
||||
console.log(state)
|
||||
if(state){
|
||||
// 重命名文件夹
|
||||
fs.renameSync(info.oldPath, info.newPath);
|
||||
// 创建种子
|
||||
await createTorrent(info.newPath,path.join(cwd(),"/tmp/torrent/" + info.seedName + ".torrent"))
|
||||
// 获取图片
|
||||
for(let i = 1; i < 4; i++){
|
||||
let time = info.Duration
|
||||
time = Math.floor(time / 4)
|
||||
await getVideoSpecifyTimeImage(info.newPath + "/" + info.rname,time * i,path.join(cwd(),"/tmp/imgs/" + i + ".jpg"))
|
||||
}
|
||||
await updateSeed(info.vid,)
|
||||
}else{
|
||||
console.log("未下载完成")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
sendSeed
|
||||
}
|
||||
Reference in New Issue
Block a user