feat(directory): removed portrait and add cache for image and audio

This commit is contained in:
Haoyu Xu
2023-02-27 23:19:19 -05:00
parent 0a320e1eb0
commit 7edc231e89
41 changed files with 127 additions and 184 deletions

View File

@@ -36,10 +36,7 @@ export default class AssetsProcessor {
const croppedBuffer = await this.#alphaCompositer.crop(portraitBuffer, rect)
await write(croppedBuffer, path.join(this.#operatorSourceFolder, this.#operatorName, `${fallback_name}_portrait.png`))
return {
landscape: await this.#generateAssets(__config.operators[this.#operatorName].filename, extractedDir),
portrait: __config.operators[this.#operatorName].portrait ? await this.#generateAssets(__config.operators[this.#operatorName].portrait, extractedDir) : null
}
return await this.#generateAssets(__config.operators[this.#operatorName].filename, extractedDir)
}
async #generateAssets(filename, extractedDir) {

View File

@@ -28,8 +28,5 @@ export default function () {
writeSync(JSON.stringify(directoryJson, null), path.join(targetFolder, "directory.json"))
filesToCopy.forEach((key) => {
copy(path.join(sourceFolder, key, 'assets.json'), path.join(targetFolder, `${__config.operators[key].filename}.json`))
if (__config.operators[key].portrait) {
copy(path.join(sourceFolder, key, 'assets_portrait.json'), path.join(targetFolder, `${__config.operators[key].portrait}.json`))
}
})
}