Comments (3)
Hey
Could you show the code you are using?
from nexrender.
hey
this is my code worker:
const { start } = require('@nexrender/worker');
const main = async () => {
const serverHost = '...'
const serverSecret = '...'
await start(serverHost, serverSecret, {
workpath: 'C:\\Users\\Administrator\\AppData\\Local\\Temp\\nexrender2',
binary: '/Users/mynames/Apllications/aerender',
skipCleanup: true,
tagSelector: false,
addLicense: false,
debug: true,
stopOnError:false
});
}
main().catch(console.error);
and this code js for preDwonload action:
const axios = require('axios');
const fs = require('fs');
const AdmZip = require('adm-zip');
const { updateStatus } = require('./updateStatus');
module.exports = (job, settings, action, type) => {
job.onChange = (job, state) => {
switch (state) {
case 'render:dorender':
updateStatus('2', job.uid, job.startedAt);
break;
case 'render:cleanup':
if(!job.error){
updateStatus('3', job.uid, job.finishedAt);
}else{
updateStatus('6', job.uid, job.errorAt);
}
break;
case 'error' :
updateStatus('6', job.uid, job.errorAt);
}
};
job.onRenderProgress = (job, progress) => {
let host = '...';
axios
.patch(`${host}/api/v1/user-project-output/update-progress/${action.id}`, {
progress: progress,
})
.then((response) => {
if (response.data.status === 'success') {
console.log(response.data.message);
} else if (response.data.status === 'error') {
console.log(response.data.message);
}
})
.catch((error) => {
console.error(error);
});
};
const url = action.url;
const extractToPath = action.extractToPath;
const userOutputPath = action.userOutputPath;
const fileName = url.split('/').pop();
const filePath = `${extractToPath}/${fileName}`;
return new Promise((resolve, reject) => {
// Check if the directory exists, create it if it doesn't
if (!fs.existsSync(extractToPath)) {
console.log(`Directory ${extractToPath} does not exist. Creating...`);
fs.mkdirSync(extractToPath, { recursive: true });
}
if (!fs.existsSync(userOutputPath)) {
console.log(`Directory ${userOutputPath} does not exist. Creating...`);
fs.mkdirSync(userOutputPath, { recursive: true });
}
console.log(filePath);
// Check if the file already exists in the directory
if (fs.existsSync(filePath)) {
console.log(`File ${fileName} already exists in ${extractToPath}`);
// Skip the download and extraction steps
resolve();
} else {
// Download the file from the URL
axios({
url: url,
method: 'GET',
responseType: 'arraybuffer',
})
.then((response) => {
const data = new Uint8Array(response.data);
console.log(`Start Project File ${fileName} Download`);
fs.writeFile(filePath, data, (err) => {
if (err) {
console.error(`Error downloading ${fileName}: ${err}`);
reject(err);
} else {
console.log(`Download of ${fileName} complete`);
// Extract the file to the specified folder
const zip = new AdmZip(filePath);
zip.extractAllTo(extractToPath, true);
console.log(`Extraction of ${fileName} complete`);
// Delete the downloaded zip file
// fs.unlinkSync(filePath);
resolve();
}
});
})
.catch((error) => {
console.error(`Error downloading ${fileName}: ${error}`);
reject(error);
});
}
});
};
and at last :
const axios = require("axios");
const baseURL = '.../api/v1';
async function updateStatus(statusRender, jobUid, time, error = null) {
try {
const response = await axios.patch(`${baseURL}/user-project-output/update-status/${jobUid}`, {
statusRender: statusRender,
error: error,
time: time,
server: ''
});
if (response.data.status === 'success') {
console.log(response.data.message);
} else if (response.data.status === 'error') {
console.log(response.data.message);
}
} catch (error) {
console.error(error);
}
}
module.exports = { updateStatus };
please help me.
from nexrender.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
from nexrender.
Related Issues (20)
- Worker Freezing On new windows installations, does not load. HOT 3
- You should provide a proper path to After Effects' "aerender" binary HOT 4
- you need to run application with admin priviledges once to install Adobe After Effects commandLineRenderer.jsx patch HOT 2
- can i use without installing adobe after effect. HOT 4
- How to change text layer color and shape layer background color with json? HOT 3
- Error: nexrender: Can't find a property sequence Color for key: Colorwithin layer HOT 2
- Nextrender is taking so much time to process and video rendering. HOT 1
- Skip download / copy assets in file/// protocol HOT 1
- Typo in the job init() Method. HOT 4
- Version Mismatch issue HOT 2
- How to target the Source Text HOT 6
- Error: Couldn't find module @nexrender/provider-e, Unknown protocol provided. HOT 2
- Name chain does not work in case last composition name matches HOT 11
- Does Necklander support After Effects 2023? Is 2024 not supported? HOT 6
- in react Is there a way to check the rendering process in percentage? HOT 11
- How do I configure multiple nexrender-workers on one nexrender-server? HOT 2
- Why after script execution AE project not changed? HOT 1
- Post render action (action-encode) seems to be failing. HOT 11
- AEP Files Parser? HOT 5
- Not able to find the text layer
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nexrender.