save changes
This commit is contained in:
@ -14,17 +14,17 @@ interface VideoRecord {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const servers = [
|
const servers = [
|
||||||
{
|
/*{
|
||||||
baseUrl: process.env.SERVER1_COMFY_BASE_URL,
|
baseUrl: process.env.SERVER1_COMFY_BASE_URL,
|
||||||
outputDir: process.env.SERVER1_COMFY_OUTPUT_DIR,
|
outputDir: process.env.SERVER1_COMFY_OUTPUT_DIR,
|
||||||
},
|
},*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
{
|
{
|
||||||
baseUrl: process.env.SERVER2_COMFY_BASE_URL,
|
baseUrl: process.env.SERVER2_COMFY_BASE_URL,
|
||||||
outputDir: process.env.SERVER2_COMFY_OUTPUT_DIR,
|
outputDir: process.env.SERVER2_COMFY_OUTPUT_DIR,
|
||||||
},
|
},
|
||||||
*/
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms));
|
const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms));
|
||||||
@ -63,7 +63,7 @@ async function worker(server: any) {
|
|||||||
while (true) {
|
while (true) {
|
||||||
await sleep(Math.random() * 3000); // Random delay
|
await sleep(Math.random() * 3000); // Random delay
|
||||||
const videosToProcess = (await query(
|
const videosToProcess = (await query(
|
||||||
"SELECT * FROM video WHERE image_prompt IS NOT NULL AND (image_path IS NULL OR image_path = '') LIMIT 1"
|
"SELECT * FROM video WHERE image_prompt IS NOT NULL AND (video_path IS NULL OR image_path = '') LIMIT 1"
|
||||||
)) as any[];
|
)) as any[];
|
||||||
|
|
||||||
if (videosToProcess.length === 0) {
|
if (videosToProcess.length === 0) {
|
||||||
|
|||||||
@ -62,10 +62,15 @@ async function generateImage(
|
|||||||
const newFilePath = path.resolve('./generated', newFileName);
|
const newFilePath = path.resolve('./generated', newFileName);
|
||||||
|
|
||||||
await fs.mkdir('./generated', { recursive: true });
|
await fs.mkdir('./generated', { recursive: true });
|
||||||
|
|
||||||
const sourcePath = path.join(COMFY_OUTPUT_DIR!, latestFile);
|
const sourcePath = path.join(COMFY_OUTPUT_DIR!, latestFile);
|
||||||
|
try {
|
||||||
|
await fs.unlink(sourcePath);
|
||||||
|
} catch (err) {
|
||||||
|
// ignore if not exists
|
||||||
|
}
|
||||||
|
|
||||||
await fs.copyFile(sourcePath, newFilePath);
|
await fs.copyFile(sourcePath, newFilePath);
|
||||||
//await fs.unlink(sourcePath);
|
|
||||||
|
|
||||||
return newFilePath;
|
return newFilePath;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user