Spaces:
Running
Running
Commit ·
8f6108e
1
Parent(s): 0483465
Backup before esm
Browse files- app.js +33 -6
- package-lock.json +77 -0
- package.json +3 -0
- src/textWithBgImage/SectionTextWithBG.tsx +13 -7
- src/textWithBgImage/SemibitComposition.tsx +14 -3
app.js
CHANGED
|
@@ -9,6 +9,7 @@ const OracleStorage = require('./common-creds/oracle/storage.json');
|
|
| 9 |
const axios = require('axios');
|
| 10 |
const { spawn, exec, ChildProcess } = require('child_process');
|
| 11 |
const { FireStoreDB } = require('multi-db-orm')
|
|
|
|
| 12 |
var kill = require('tree-kill');
|
| 13 |
|
| 14 |
let pl = {
|
|
@@ -81,7 +82,7 @@ function render() {
|
|
| 81 |
|
| 82 |
const db = new FireStoreDB(path.join(__dirname, 'common-creds/firebase/semibitmedia.json'))
|
| 83 |
|
| 84 |
-
function modifyFiles(originalManuscript) {
|
| 85 |
|
| 86 |
let fname = path.join(__dirname, "./src/textWithBgImage/SequentialScene.orig.tsx")
|
| 87 |
let fnameTarget = path.join(__dirname, "./src/textWithBgImage/SequentialScene.tsx")
|
|
@@ -94,10 +95,32 @@ function modifyFiles(originalManuscript) {
|
|
| 94 |
seqScene = seqScene + `\n{getScene(contents[${index}])}\n`
|
| 95 |
}
|
| 96 |
|
|
|
|
|
|
|
|
|
|
| 97 |
fs.writeFileSync(fnameTarget, SequentialSceneText.replace("{getScene(contents[0])}", seqScene));
|
| 98 |
|
| 99 |
}
|
| 100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
async function extract(filePath) {
|
| 102 |
await UnzipFiles(filePath, './public')
|
| 103 |
}
|
|
@@ -175,6 +198,7 @@ app.all('/render', async (req, res) => {
|
|
| 175 |
resolve()
|
| 176 |
}
|
| 177 |
})
|
|
|
|
| 178 |
const perf = new PerformanceRecorder()
|
| 179 |
perf.reset()
|
| 180 |
let bundleUrl = req.query.fileUrl
|
|
@@ -198,7 +222,7 @@ app.all('/render', async (req, res) => {
|
|
| 198 |
let manuObj = JSON.parse(fs.readFileSync(manuFile).toString())
|
| 199 |
currentRenderJobId = manuObj.id
|
| 200 |
let jobID = manuObj.id
|
| 201 |
-
modifyFiles(manuObj)
|
| 202 |
const uploader = new FileUploader('oracle', OracleStorage.semibit_media)
|
| 203 |
if (!skipRender) {
|
| 204 |
Utils.clearFolder(path.join(__dirname, 'out'))
|
|
@@ -435,8 +459,11 @@ module.exports = app
|
|
| 435 |
// doRender()
|
| 436 |
|
| 437 |
if (process.env.MODIFY_FILES) {
|
| 438 |
-
let
|
| 439 |
-
|
| 440 |
-
|
| 441 |
-
|
|
|
|
|
|
|
|
|
|
| 442 |
}
|
|
|
|
| 9 |
const axios = require('axios');
|
| 10 |
const { spawn, exec, ChildProcess } = require('child_process');
|
| 11 |
const { FireStoreDB } = require('multi-db-orm')
|
| 12 |
+
var syllableCounter = require('syllable-count-english')
|
| 13 |
var kill = require('tree-kill');
|
| 14 |
|
| 15 |
let pl = {
|
|
|
|
| 82 |
|
| 83 |
const db = new FireStoreDB(path.join(__dirname, 'common-creds/firebase/semibitmedia.json'))
|
| 84 |
|
| 85 |
+
function modifyFiles(originalManuscript, originalManuscriptFile) {
|
| 86 |
|
| 87 |
let fname = path.join(__dirname, "./src/textWithBgImage/SequentialScene.orig.tsx")
|
| 88 |
let fnameTarget = path.join(__dirname, "./src/textWithBgImage/SequentialScene.tsx")
|
|
|
|
| 95 |
seqScene = seqScene + `\n{getScene(contents[${index}])}\n`
|
| 96 |
}
|
| 97 |
|
| 98 |
+
generateSubtitles(originalManuscript)
|
| 99 |
+
fs.writeFileSync(originalManuscriptFile, JSON.stringify(originalManuscript, null, 2))
|
| 100 |
+
|
| 101 |
fs.writeFileSync(fnameTarget, SequentialSceneText.replace("{getScene(contents[0])}", seqScene));
|
| 102 |
|
| 103 |
}
|
| 104 |
|
| 105 |
+
function generateSubtitles(originalManuscript) {
|
| 106 |
+
|
| 107 |
+
let transcript = originalManuscript.transcript
|
| 108 |
+
for (let index = 0; index < transcript.length; index++) {
|
| 109 |
+
const section = transcript[index];
|
| 110 |
+
section.subtitles = section.text.split(".").map(t => {
|
| 111 |
+
return {
|
| 112 |
+
text: t,
|
| 113 |
+
expectedDurationSec: getDurationForSentenceByPhenone(t)
|
| 114 |
+
}
|
| 115 |
+
})
|
| 116 |
+
}
|
| 117 |
+
return originalManuscript
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
function getDurationForSentenceByPhenone(text) {
|
| 121 |
+
return syllableCounter.syllableCount(text)
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
async function extract(filePath) {
|
| 125 |
await UnzipFiles(filePath, './public')
|
| 126 |
}
|
|
|
|
| 198 |
resolve()
|
| 199 |
}
|
| 200 |
})
|
| 201 |
+
clear()
|
| 202 |
const perf = new PerformanceRecorder()
|
| 203 |
perf.reset()
|
| 204 |
let bundleUrl = req.query.fileUrl
|
|
|
|
| 222 |
let manuObj = JSON.parse(fs.readFileSync(manuFile).toString())
|
| 223 |
currentRenderJobId = manuObj.id
|
| 224 |
let jobID = manuObj.id
|
| 225 |
+
modifyFiles(manuObj, manuFile)
|
| 226 |
const uploader = new FileUploader('oracle', OracleStorage.semibit_media)
|
| 227 |
if (!skipRender) {
|
| 228 |
Utils.clearFolder(path.join(__dirname, 'out'))
|
|
|
|
| 459 |
// doRender()
|
| 460 |
|
| 461 |
if (process.env.MODIFY_FILES) {
|
| 462 |
+
let filePath = 'public/@export_607c230fef.zip'
|
| 463 |
+
extract(filePath).then(() => {
|
| 464 |
+
let manuFile = path.join(__dirname, 'public/original_manuscript.json')
|
| 465 |
+
let manuObj = JSON.parse(fs.readFileSync(manuFile).toString())
|
| 466 |
+
modifyFiles(manuObj, manuFile)
|
| 467 |
+
console.log('Sequence Generated')
|
| 468 |
+
})
|
| 469 |
}
|
package-lock.json
CHANGED
|
@@ -40,6 +40,7 @@
|
|
| 40 |
"remotion-transition-series": "^0.0.10",
|
| 41 |
"socket.io": "^4.7.2",
|
| 42 |
"styled-components": "^6.0.5",
|
|
|
|
| 43 |
"tree-kill": "^1.2.2",
|
| 44 |
"ts-node-dev": "^2.0.0",
|
| 45 |
"typescript": "^4.9.4",
|
|
@@ -4576,6 +4577,11 @@
|
|
| 4576 |
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.5.tgz",
|
| 4577 |
"integrity": "sha512-rt40Nk13II9JwQBdeYqmbn2Q6IVTA5uPhvSO+JVqdXw/6/4glI6oR9ezty/A9Hg5u7JH4OmYmuQ+XvjKm0Datg=="
|
| 4578 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4579 |
"node_modules/@types/prop-types": {
|
| 4580 |
"version": "15.7.5",
|
| 4581 |
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz",
|
|
@@ -11935,6 +11941,11 @@
|
|
| 11935 |
"node": ">=0.10.0"
|
| 11936 |
}
|
| 11937 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11938 |
"node_modules/npm": {
|
| 11939 |
"version": "9.8.1",
|
| 11940 |
"resolved": "https://registry.npmjs.org/npm/-/npm-9.8.1.tgz",
|
|
@@ -15249,6 +15260,14 @@
|
|
| 15249 |
"node": ">= 6"
|
| 15250 |
}
|
| 15251 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15252 |
"node_modules/postcss": {
|
| 15253 |
"version": "8.4.27",
|
| 15254 |
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.27.tgz",
|
|
@@ -17427,6 +17446,31 @@
|
|
| 17427 |
"url": "https://github.com/sponsors/ljharb"
|
| 17428 |
}
|
| 17429 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17430 |
"node_modules/tailwindcss": {
|
| 17431 |
"version": "3.3.3",
|
| 17432 |
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.3.tgz",
|
|
@@ -21607,6 +21651,11 @@
|
|
| 21607 |
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.5.tgz",
|
| 21608 |
"integrity": "sha512-rt40Nk13II9JwQBdeYqmbn2Q6IVTA5uPhvSO+JVqdXw/6/4glI6oR9ezty/A9Hg5u7JH4OmYmuQ+XvjKm0Datg=="
|
| 21609 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21610 |
"@types/prop-types": {
|
| 21611 |
"version": "15.7.5",
|
| 21612 |
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz",
|
|
@@ -27187,6 +27236,11 @@
|
|
| 27187 |
"resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz",
|
| 27188 |
"integrity": "sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA=="
|
| 27189 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27190 |
"npm": {
|
| 27191 |
"version": "9.8.1",
|
| 27192 |
"resolved": "https://registry.npmjs.org/npm/-/npm-9.8.1.tgz",
|
|
@@ -29334,6 +29388,11 @@
|
|
| 29334 |
"resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz",
|
| 29335 |
"integrity": "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg=="
|
| 29336 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29337 |
"postcss": {
|
| 29338 |
"version": "8.4.27",
|
| 29339 |
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.27.tgz",
|
|
@@ -30776,6 +30835,24 @@
|
|
| 30776 |
"resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
|
| 30777 |
"integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w=="
|
| 30778 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30779 |
"tailwindcss": {
|
| 30780 |
"version": "3.3.3",
|
| 30781 |
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.3.tgz",
|
|
|
|
| 40 |
"remotion-transition-series": "^0.0.10",
|
| 41 |
"socket.io": "^4.7.2",
|
| 42 |
"styled-components": "^6.0.5",
|
| 43 |
+
"syllable-count-english": "^1.0.6",
|
| 44 |
"tree-kill": "^1.2.2",
|
| 45 |
"ts-node-dev": "^2.0.0",
|
| 46 |
"typescript": "^4.9.4",
|
|
|
|
| 4577 |
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.5.tgz",
|
| 4578 |
"integrity": "sha512-rt40Nk13II9JwQBdeYqmbn2Q6IVTA5uPhvSO+JVqdXw/6/4glI6oR9ezty/A9Hg5u7JH4OmYmuQ+XvjKm0Datg=="
|
| 4579 |
},
|
| 4580 |
+
"node_modules/@types/pluralize": {
|
| 4581 |
+
"version": "0.0.29",
|
| 4582 |
+
"resolved": "https://registry.npmjs.org/@types/pluralize/-/pluralize-0.0.29.tgz",
|
| 4583 |
+
"integrity": "sha512-BYOID+l2Aco2nBik+iYS4SZX0Lf20KPILP5RGmM1IgzdwNdTs0eebiFriOPcej1sX9mLnSoiNte5zcFxssgpGA=="
|
| 4584 |
+
},
|
| 4585 |
"node_modules/@types/prop-types": {
|
| 4586 |
"version": "15.7.5",
|
| 4587 |
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz",
|
|
|
|
| 11941 |
"node": ">=0.10.0"
|
| 11942 |
}
|
| 11943 |
},
|
| 11944 |
+
"node_modules/normalize-strings": {
|
| 11945 |
+
"version": "1.1.1",
|
| 11946 |
+
"resolved": "https://registry.npmjs.org/normalize-strings/-/normalize-strings-1.1.1.tgz",
|
| 11947 |
+
"integrity": "sha512-fARPRdTwmrQDLYhmeh7j/eZwrCP6WzxD6uKOdK/hT/uKACAE9AG2Bc2dgqOZLkfmmctHpfcJ9w3AQnfLgg3GYg=="
|
| 11948 |
+
},
|
| 11949 |
"node_modules/npm": {
|
| 11950 |
"version": "9.8.1",
|
| 11951 |
"resolved": "https://registry.npmjs.org/npm/-/npm-9.8.1.tgz",
|
|
|
|
| 15260 |
"node": ">= 6"
|
| 15261 |
}
|
| 15262 |
},
|
| 15263 |
+
"node_modules/pluralize": {
|
| 15264 |
+
"version": "8.0.0",
|
| 15265 |
+
"resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz",
|
| 15266 |
+
"integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==",
|
| 15267 |
+
"engines": {
|
| 15268 |
+
"node": ">=4"
|
| 15269 |
+
}
|
| 15270 |
+
},
|
| 15271 |
"node_modules/postcss": {
|
| 15272 |
"version": "8.4.27",
|
| 15273 |
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.27.tgz",
|
|
|
|
| 17446 |
"url": "https://github.com/sponsors/ljharb"
|
| 17447 |
}
|
| 17448 |
},
|
| 17449 |
+
"node_modules/syllable": {
|
| 17450 |
+
"version": "5.0.1",
|
| 17451 |
+
"resolved": "https://registry.npmjs.org/syllable/-/syllable-5.0.1.tgz",
|
| 17452 |
+
"integrity": "sha512-HWtNCp6v7J8H0lrT8j1HHjfOLltRoDcC7QRFVu25p4BE52JqetXG65nqC7CsatT8WQRfY4Qvh93BWJIUxbmXFg==",
|
| 17453 |
+
"dependencies": {
|
| 17454 |
+
"@types/pluralize": "^0.0.29",
|
| 17455 |
+
"normalize-strings": "^1.1.0",
|
| 17456 |
+
"pluralize": "^8.0.0"
|
| 17457 |
+
},
|
| 17458 |
+
"bin": {
|
| 17459 |
+
"syllable": "cli.js"
|
| 17460 |
+
},
|
| 17461 |
+
"funding": {
|
| 17462 |
+
"type": "github",
|
| 17463 |
+
"url": "https://github.com/sponsors/wooorm"
|
| 17464 |
+
}
|
| 17465 |
+
},
|
| 17466 |
+
"node_modules/syllable-count-english": {
|
| 17467 |
+
"version": "1.0.6",
|
| 17468 |
+
"resolved": "https://registry.npmjs.org/syllable-count-english/-/syllable-count-english-1.0.6.tgz",
|
| 17469 |
+
"integrity": "sha512-Z0Sj+Djb9jMOQqJACqx93zGXbKOxKvWUwxQJ878leGHM4RWhxBDcvem/311xUY4cTPY+8sgkiYpr+nEStSg0DA==",
|
| 17470 |
+
"dependencies": {
|
| 17471 |
+
"syllable": "^5.0.1"
|
| 17472 |
+
}
|
| 17473 |
+
},
|
| 17474 |
"node_modules/tailwindcss": {
|
| 17475 |
"version": "3.3.3",
|
| 17476 |
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.3.tgz",
|
|
|
|
| 21651 |
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.5.tgz",
|
| 21652 |
"integrity": "sha512-rt40Nk13II9JwQBdeYqmbn2Q6IVTA5uPhvSO+JVqdXw/6/4glI6oR9ezty/A9Hg5u7JH4OmYmuQ+XvjKm0Datg=="
|
| 21653 |
},
|
| 21654 |
+
"@types/pluralize": {
|
| 21655 |
+
"version": "0.0.29",
|
| 21656 |
+
"resolved": "https://registry.npmjs.org/@types/pluralize/-/pluralize-0.0.29.tgz",
|
| 21657 |
+
"integrity": "sha512-BYOID+l2Aco2nBik+iYS4SZX0Lf20KPILP5RGmM1IgzdwNdTs0eebiFriOPcej1sX9mLnSoiNte5zcFxssgpGA=="
|
| 21658 |
+
},
|
| 21659 |
"@types/prop-types": {
|
| 21660 |
"version": "15.7.5",
|
| 21661 |
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz",
|
|
|
|
| 27236 |
"resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz",
|
| 27237 |
"integrity": "sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA=="
|
| 27238 |
},
|
| 27239 |
+
"normalize-strings": {
|
| 27240 |
+
"version": "1.1.1",
|
| 27241 |
+
"resolved": "https://registry.npmjs.org/normalize-strings/-/normalize-strings-1.1.1.tgz",
|
| 27242 |
+
"integrity": "sha512-fARPRdTwmrQDLYhmeh7j/eZwrCP6WzxD6uKOdK/hT/uKACAE9AG2Bc2dgqOZLkfmmctHpfcJ9w3AQnfLgg3GYg=="
|
| 27243 |
+
},
|
| 27244 |
"npm": {
|
| 27245 |
"version": "9.8.1",
|
| 27246 |
"resolved": "https://registry.npmjs.org/npm/-/npm-9.8.1.tgz",
|
|
|
|
| 29388 |
"resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz",
|
| 29389 |
"integrity": "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg=="
|
| 29390 |
},
|
| 29391 |
+
"pluralize": {
|
| 29392 |
+
"version": "8.0.0",
|
| 29393 |
+
"resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz",
|
| 29394 |
+
"integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA=="
|
| 29395 |
+
},
|
| 29396 |
"postcss": {
|
| 29397 |
"version": "8.4.27",
|
| 29398 |
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.27.tgz",
|
|
|
|
| 30835 |
"resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
|
| 30836 |
"integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w=="
|
| 30837 |
},
|
| 30838 |
+
"syllable": {
|
| 30839 |
+
"version": "5.0.1",
|
| 30840 |
+
"resolved": "https://registry.npmjs.org/syllable/-/syllable-5.0.1.tgz",
|
| 30841 |
+
"integrity": "sha512-HWtNCp6v7J8H0lrT8j1HHjfOLltRoDcC7QRFVu25p4BE52JqetXG65nqC7CsatT8WQRfY4Qvh93BWJIUxbmXFg==",
|
| 30842 |
+
"requires": {
|
| 30843 |
+
"@types/pluralize": "^0.0.29",
|
| 30844 |
+
"normalize-strings": "^1.1.0",
|
| 30845 |
+
"pluralize": "^8.0.0"
|
| 30846 |
+
}
|
| 30847 |
+
},
|
| 30848 |
+
"syllable-count-english": {
|
| 30849 |
+
"version": "1.0.6",
|
| 30850 |
+
"resolved": "https://registry.npmjs.org/syllable-count-english/-/syllable-count-english-1.0.6.tgz",
|
| 30851 |
+
"integrity": "sha512-Z0Sj+Djb9jMOQqJACqx93zGXbKOxKvWUwxQJ878leGHM4RWhxBDcvem/311xUY4cTPY+8sgkiYpr+nEStSg0DA==",
|
| 30852 |
+
"requires": {
|
| 30853 |
+
"syllable": "^5.0.1"
|
| 30854 |
+
}
|
| 30855 |
+
},
|
| 30856 |
"tailwindcss": {
|
| 30857 |
"version": "3.3.3",
|
| 30858 |
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.3.tgz",
|
package.json
CHANGED
|
@@ -7,6 +7,8 @@
|
|
| 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 ",
|
|
@@ -61,6 +63,7 @@
|
|
| 61 |
"remotion-transition-series": "^0.0.10",
|
| 62 |
"socket.io": "^4.7.2",
|
| 63 |
"styled-components": "^6.0.5",
|
|
|
|
| 64 |
"tree-kill": "^1.2.2",
|
| 65 |
"ts-node-dev": "^2.0.0",
|
| 66 |
"typescript": "^4.9.4",
|
|
|
|
| 7 |
],
|
| 8 |
"scripts": {
|
| 9 |
"start": "node server.js",
|
| 10 |
+
"extract32": "set MODIFY_FILES=1 && node app.js",
|
| 11 |
+
"extract": "MODIFY_FILES=1 && node app.js",
|
| 12 |
"preview": "remotion studio",
|
| 13 |
"render-build": "remotion render --image-format=jpeg --quality=70 --gl=angle SemibitComposition",
|
| 14 |
"render-still": "remotion still --image-format=jpeg SemibitCompositionPoster ",
|
|
|
|
| 63 |
"remotion-transition-series": "^0.0.10",
|
| 64 |
"socket.io": "^4.7.2",
|
| 65 |
"styled-components": "^6.0.5",
|
| 66 |
+
"syllable-count-english": "^1.0.6",
|
| 67 |
"tree-kill": "^1.2.2",
|
| 68 |
"ts-node-dev": "^2.0.0",
|
| 69 |
"typescript": "^4.9.4",
|
src/textWithBgImage/SectionTextWithBG.tsx
CHANGED
|
@@ -28,7 +28,7 @@ function adjustFontSize(text: string, fullFont: number, minFontSizeDef): number
|
|
| 28 |
|
| 29 |
export const SectionTextWithBG: React.FC<SequentialSceneData> = (props) => {
|
| 30 |
|
| 31 |
-
var { text, durationInSecs, textColor = '#fff', duration, direction = 'left', bgImagePath, audioPath, commulativeDurationStartSec,
|
| 32 |
title, pointers, emphasisOnImage, durationInSecs, rootProps } = props
|
| 33 |
|
| 34 |
const videoConfig = useVideoConfig();
|
|
@@ -39,20 +39,26 @@ export const SectionTextWithBG: React.FC<SequentialSceneData> = (props) => {
|
|
| 39 |
let textBgColor = textColor;
|
| 40 |
let textFontColor = "#fff";
|
| 41 |
|
| 42 |
-
const
|
| 43 |
var aggFrames = 0
|
| 44 |
text = text.trim()
|
| 45 |
if (text.startsWith(".")) {
|
| 46 |
text = text.replace(".", "")
|
| 47 |
}
|
| 48 |
-
const sentenceMap = text.split('.').map((t) => {
|
| 49 |
-
let
|
| 50 |
-
let expectedDurationSec = durationInSecs * (
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
aggFrames = aggFrames + expectedDurationFrames
|
| 53 |
expectedDurationFrames = Math.floor(expectedDurationFrames)
|
| 54 |
return {
|
| 55 |
-
text:
|
| 56 |
expectedDurationSec,
|
| 57 |
expectedDurationFrames,
|
| 58 |
startFrame: Math.max(0, aggFrames - expectedDurationFrames),
|
|
|
|
| 28 |
|
| 29 |
export const SectionTextWithBG: React.FC<SequentialSceneData> = (props) => {
|
| 30 |
|
| 31 |
+
var { text, subtitles, durationInSecs, textColor = '#fff', duration, direction = 'left', bgImagePath, audioPath, commulativeDurationStartSec,
|
| 32 |
title, pointers, emphasisOnImage, durationInSecs, rootProps } = props
|
| 33 |
|
| 34 |
const videoConfig = useVideoConfig();
|
|
|
|
| 39 |
let textBgColor = textColor;
|
| 40 |
let textFontColor = "#fff";
|
| 41 |
|
| 42 |
+
const totalChars = text.length
|
| 43 |
var aggFrames = 0
|
| 44 |
text = text.trim()
|
| 45 |
if (text.startsWith(".")) {
|
| 46 |
text = text.replace(".", "")
|
| 47 |
}
|
| 48 |
+
const sentenceMap = (subtitles || text.split('.').map((t) => {
|
| 49 |
+
let charCount = text.length
|
| 50 |
+
let expectedDurationSec = durationInSecs * (charCount / totalChars)
|
| 51 |
+
return {
|
| 52 |
+
text: t,
|
| 53 |
+
expectedDurationSec: expectedDurationSec
|
| 54 |
+
}
|
| 55 |
+
})
|
| 56 |
+
).map(({ text, expectedDurationSec }) => {
|
| 57 |
+
let expectedDurationFrames = expectedDurationSec * fps
|
| 58 |
aggFrames = aggFrames + expectedDurationFrames
|
| 59 |
expectedDurationFrames = Math.floor(expectedDurationFrames)
|
| 60 |
return {
|
| 61 |
+
text: text.trim(),
|
| 62 |
expectedDurationSec,
|
| 63 |
expectedDurationFrames,
|
| 64 |
startFrame: Math.max(0, aggFrames - expectedDurationFrames),
|
src/textWithBgImage/SemibitComposition.tsx
CHANGED
|
@@ -7,6 +7,7 @@ import { PosterSingleTextWithBG } from './PosterSingleTextWithBG';
|
|
| 7 |
import { YoutubeCategoriesConfig } from './Categories';
|
| 8 |
import '../style.css';
|
| 9 |
import { preloadImage, preloadVideo } from "@remotion/preload";
|
|
|
|
| 10 |
|
| 11 |
|
| 12 |
function getFileName(filePath: string, subdirpath?: string): string {
|
|
@@ -67,8 +68,15 @@ export const SemibitComposition: React.FC = () => {
|
|
| 67 |
if (curDurSecs < 3) {
|
| 68 |
curDurSecs = 3
|
| 69 |
}
|
| 70 |
-
|
| 71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
lastDirection = !lastDirection
|
| 73 |
imageAbsPaths.forEach(im => {
|
| 74 |
if (im.startsWith("http")) {
|
|
@@ -105,9 +113,10 @@ export const SemibitComposition: React.FC = () => {
|
|
| 105 |
durationInSec: 5.433,
|
| 106 |
file: Script.meta.tenantVideoConfig ? getFileName(Script.meta.tenantVideoConfig.introFile, "assets") : 'assets/music_intro.mp4'
|
| 107 |
}
|
|
|
|
| 108 |
const outro = {
|
| 109 |
durationInFrames: 0,
|
| 110 |
-
durationInSec: 8.034,
|
| 111 |
file: Script.meta.tenantVideoConfig ? getFileName(Script.meta.tenantVideoConfig.outroFile, "assets") : 'assets/music_outro.mp4'
|
| 112 |
}
|
| 113 |
|
|
@@ -118,6 +127,8 @@ export const SemibitComposition: React.FC = () => {
|
|
| 118 |
|
| 119 |
if (outro) {
|
| 120 |
durationInSec += outro.durationInSec
|
|
|
|
|
|
|
| 121 |
outro.durationInFrames = Math.ceil(fps * outro.durationInSec)
|
| 122 |
}
|
| 123 |
|
|
|
|
| 7 |
import { YoutubeCategoriesConfig } from './Categories';
|
| 8 |
import '../style.css';
|
| 9 |
import { preloadImage, preloadVideo } from "@remotion/preload";
|
| 10 |
+
import Transitions from '../../public/assets/transitions.json'
|
| 11 |
|
| 12 |
|
| 13 |
function getFileName(filePath: string, subdirpath?: string): string {
|
|
|
|
| 68 |
if (curDurSecs < 3) {
|
| 69 |
curDurSecs = 3
|
| 70 |
}
|
| 71 |
+
//@ts-ignore
|
| 72 |
+
const transitionFile = section?.transition_file || Transitions[0].file
|
| 73 |
+
//@ts-ignore
|
| 74 |
+
const transitionDurationSec = (section?.transition_duration_sec || Transitions[0].durationSec)
|
| 75 |
+
const transitionDurationFrames = transitionDurationSec * fps
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
let commDuration = durationInSec + transitionDurationSec
|
| 79 |
+
durationInSec = durationInSec + curDurSecs + transitionDurationSec
|
| 80 |
lastDirection = !lastDirection
|
| 81 |
imageAbsPaths.forEach(im => {
|
| 82 |
if (im.startsWith("http")) {
|
|
|
|
| 113 |
durationInSec: 5.433,
|
| 114 |
file: Script.meta.tenantVideoConfig ? getFileName(Script.meta.tenantVideoConfig.introFile, "assets") : 'assets/music_intro.mp4'
|
| 115 |
}
|
| 116 |
+
let ADJUST_END_DUR_SEC = 3
|
| 117 |
const outro = {
|
| 118 |
durationInFrames: 0,
|
| 119 |
+
durationInSec: 8.034 - ADJUST_END_DUR_SEC,
|
| 120 |
file: Script.meta.tenantVideoConfig ? getFileName(Script.meta.tenantVideoConfig.outroFile, "assets") : 'assets/music_outro.mp4'
|
| 121 |
}
|
| 122 |
|
|
|
|
| 127 |
|
| 128 |
if (outro) {
|
| 129 |
durationInSec += outro.durationInSec
|
| 130 |
+
//hack for blank end
|
| 131 |
+
outro.durationInSec += ADJUST_END_DUR_SEC
|
| 132 |
outro.durationInFrames = Math.ceil(fps * outro.durationInSec)
|
| 133 |
}
|
| 134 |
|