mirror of
https://github.com/qwertyforce/scenery.git
synced 2025-05-02 21:49:51 +00:00
fix the previous fix
This commit is contained in:
parent
c166089f04
commit
6bb0320c8e
@ -1,23 +1,22 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
import fs from 'fs'
|
||||
import fsp from "fs/promises";
|
||||
import config from "../../config/config"
|
||||
import db_ops from '../helpers/db_ops'
|
||||
|
||||
const PATH_TO_PUBLIC_UPSCALED= path.join(config.root_path, 'public', 'upscaled')
|
||||
const PATH_TO_UPSCALED = path.join(config.root_path,'upscaled')
|
||||
const PUBLIC_UPSCALED = fs.readdirSync(PATH_TO_PUBLIC_UPSCALED)
|
||||
const UPSCALED = fs.readdirSync(PATH_TO_UPSCALED)
|
||||
const { COPYFILE_EXCL } = fs.constants;
|
||||
function callback(err: any) {
|
||||
if (err) throw err;
|
||||
}
|
||||
|
||||
async function import_upscaled() {
|
||||
for (const image_file_name of UPSCALED) {
|
||||
const file_name=image_file_name.split('.') // image.png.png (esrgan-ncnn-vulkan)
|
||||
if(!PUBLIC_UPSCALED.includes(`${file_name[0]}.png`)){
|
||||
console.log(`importing ${image_file_name}`)
|
||||
fs.copyFile(`${PATH_TO_UPSCALED}/${image_file_name}`, `${PATH_TO_PUBLIC_UPSCALED}/${file_name[0]}.png`, COPYFILE_EXCL,callback )
|
||||
await fsp.copyFile(`${PATH_TO_UPSCALED}/${image_file_name}`, `${PATH_TO_PUBLIC_UPSCALED}/${file_name[0]}.png`, COPYFILE_EXCL)
|
||||
await db_ops.image_ops.add_tags_to_image_by_id(parseInt(file_name[0]),['upscaled'])
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user