Spaces:
Running
Running
Commit ·
87f9eb2
1
Parent(s): 2d7b087
Fixes
Browse files- app.js +24 -8
- index.js +1 -8
- package-lock.json +0 -0
- package.json +1 -3
app.js
CHANGED
|
@@ -148,12 +148,23 @@ app.all('/render', async (req, res) => {
|
|
| 148 |
modifyFiles(manuObj)
|
| 149 |
|
| 150 |
if (!skipRender) {
|
| 151 |
-
doRender()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
}
|
| 153 |
|
| 154 |
-
|
| 155 |
-
job_id: manuObj.id
|
| 156 |
-
})
|
| 157 |
}
|
| 158 |
else {
|
| 159 |
res.status(400)
|
|
@@ -206,7 +217,7 @@ function doRender(status) {
|
|
| 206 |
const npmScript = 'render-build';
|
| 207 |
const childProcess = exec(`npm run ${npmScript}`);
|
| 208 |
|
| 209 |
-
|
| 210 |
childProcess.stdout.on('data', (data) => {
|
| 211 |
console.log(data.toString());
|
| 212 |
});
|
|
@@ -217,10 +228,14 @@ function doRender(status) {
|
|
| 217 |
|
| 218 |
// Listen for the completion of the child process
|
| 219 |
childProcess.on('close', (code) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 220 |
if (code === 0) {
|
| 221 |
-
console.log(`
|
| 222 |
} else {
|
| 223 |
-
console.error(`
|
| 224 |
}
|
| 225 |
})
|
| 226 |
}
|
|
@@ -233,9 +248,10 @@ app.get('/', (req, res) => {
|
|
| 233 |
fs.writeFileSync(indexFile, fs.readFileSync(indexFile).toString().replace("___ORACLE_API_BASE___", oracleAPI))
|
| 234 |
|
| 235 |
|
| 236 |
-
|
| 237 |
module.exports = app
|
| 238 |
|
|
|
|
| 239 |
// let manuFile = path.join(__dirname, 'public/original_manuscript.json')
|
| 240 |
// let manuObj: OriginalManuscript = JSON.parse(fs.readFileSync(manuFile).toString())
|
| 241 |
// modifyFiles(manuObj)
|
|
|
|
| 148 |
modifyFiles(manuObj)
|
| 149 |
|
| 150 |
if (!skipRender) {
|
| 151 |
+
doRender((result) => {
|
| 152 |
+
res.send({
|
| 153 |
+
status: result,
|
| 154 |
+
job_id: manuObj.id
|
| 155 |
+
})
|
| 156 |
+
})
|
| 157 |
+
}
|
| 158 |
+
else {
|
| 159 |
+
console.log('Skipping render')
|
| 160 |
+
res.send({
|
| 161 |
+
status: result,
|
| 162 |
+
message: 'render skipped',
|
| 163 |
+
job_id: manuObj.id
|
| 164 |
+
})
|
| 165 |
}
|
| 166 |
|
| 167 |
+
|
|
|
|
|
|
|
| 168 |
}
|
| 169 |
else {
|
| 170 |
res.status(400)
|
|
|
|
| 217 |
const npmScript = 'render-build';
|
| 218 |
const childProcess = exec(`npm run ${npmScript}`);
|
| 219 |
|
| 220 |
+
console.log('Starting render')
|
| 221 |
childProcess.stdout.on('data', (data) => {
|
| 222 |
console.log(data.toString());
|
| 223 |
});
|
|
|
|
| 228 |
|
| 229 |
// Listen for the completion of the child process
|
| 230 |
childProcess.on('close', (code) => {
|
| 231 |
+
console.log('Render finished')
|
| 232 |
+
|
| 233 |
+
if (status)
|
| 234 |
+
status(code)
|
| 235 |
if (code === 0) {
|
| 236 |
+
console.log(`'${npmScript}' completed successfully.`);
|
| 237 |
} else {
|
| 238 |
+
console.error(`'${npmScript}' failed with code ${code}.`);
|
| 239 |
}
|
| 240 |
})
|
| 241 |
}
|
|
|
|
| 248 |
fs.writeFileSync(indexFile, fs.readFileSync(indexFile).toString().replace("___ORACLE_API_BASE___", oracleAPI))
|
| 249 |
|
| 250 |
|
| 251 |
+
|
| 252 |
module.exports = app
|
| 253 |
|
| 254 |
+
// doRender()
|
| 255 |
// let manuFile = path.join(__dirname, 'public/original_manuscript.json')
|
| 256 |
// let manuObj: OriginalManuscript = JSON.parse(fs.readFileSync(manuFile).toString())
|
| 257 |
// modifyFiles(manuObj)
|
index.js
CHANGED
|
@@ -6,19 +6,12 @@ const { initializeApp } = require("firebase-admin/app");
|
|
| 6 |
const app = require("./app");
|
| 7 |
setGlobalOptions({
|
| 8 |
region: "us-central1",
|
| 9 |
-
|
| 10 |
maxInstances: 1,
|
| 11 |
minInstances: 0
|
| 12 |
});
|
| 13 |
|
| 14 |
initializeApp();
|
| 15 |
|
| 16 |
-
exports.ping = onRequest(async (req, res) => {
|
| 17 |
-
const original = req.query.text;
|
| 18 |
-
|
| 19 |
-
res.json({ result: `Working` });
|
| 20 |
-
});
|
| 21 |
-
|
| 22 |
-
|
| 23 |
exports.semibitmediarenderfarm = onRequest(app);
|
| 24 |
|
|
|
|
| 6 |
const app = require("./app");
|
| 7 |
setGlobalOptions({
|
| 8 |
region: "us-central1",
|
| 9 |
+
memory: "4GiB",
|
| 10 |
maxInstances: 1,
|
| 11 |
minInstances: 0
|
| 12 |
});
|
| 13 |
|
| 14 |
initializeApp();
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
exports.semibitmediarenderfarm = onRequest(app);
|
| 17 |
|
package-lock.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
package.json
CHANGED
|
@@ -6,13 +6,11 @@
|
|
| 6 |
"*.css"
|
| 7 |
],
|
| 8 |
"scripts": {
|
| 9 |
-
"start": "
|
| 10 |
"preview": "remotion studio",
|
| 11 |
"render-build": "remotion render --image-format=jpeg --quality=70 --gl=angle SemibitComposition ",
|
| 12 |
"render-still": "remotion still --image-format=jpeg SemibitCompositionPoster ",
|
| 13 |
-
"build": "tsc --noEmitOnError --noUnusedLocals --noUnusedParameters --allowUnusedLabels",
|
| 14 |
"upgrade": "remotion upgrade",
|
| 15 |
-
"test": "eslint src --ext ts,tsx,js,jsx && tsc",
|
| 16 |
"postinstall": "cd node_modules/common-utils && npm run build && cd ../../ && node ffmpeg-fix.js",
|
| 17 |
"serve": "firebase emulators:start --only functions --project semibitmedia",
|
| 18 |
"shell": "firebase functions:shell --project semibitmedia",
|
|
|
|
| 6 |
"*.css"
|
| 7 |
],
|
| 8 |
"scripts": {
|
| 9 |
+
"start": "node server.js",
|
| 10 |
"preview": "remotion studio",
|
| 11 |
"render-build": "remotion render --image-format=jpeg --quality=70 --gl=angle SemibitComposition ",
|
| 12 |
"render-still": "remotion still --image-format=jpeg SemibitCompositionPoster ",
|
|
|
|
| 13 |
"upgrade": "remotion upgrade",
|
|
|
|
| 14 |
"postinstall": "cd node_modules/common-utils && npm run build && cd ../../ && node ffmpeg-fix.js",
|
| 15 |
"serve": "firebase emulators:start --only functions --project semibitmedia",
|
| 16 |
"shell": "firebase functions:shell --project semibitmedia",
|