Ajouter la mise à jour du fichier vidéo et gérer les erreurs lors du rendu
This commit is contained in:
@@ -315,13 +315,23 @@ router.post('/videos/render/:video_id', (req, res) => {
|
|||||||
const project_id = results.rows[0].project_id;
|
const project_id = results.rows[0].project_id;
|
||||||
console.log('Measurement IDs:', measurementIds);
|
console.log('Measurement IDs:', measurementIds);
|
||||||
console.log('Project ID:', project_id);
|
console.log('Project ID:', project_id);
|
||||||
measureManager.getPathList(measurementIds, project_id).then(pathList => {
|
const pathList = measureManager.getPathList(measurementIds, project_id).then(pathList => {
|
||||||
console.log('Path list:', pathList);
|
console.log('Path list:', pathList);
|
||||||
res.json({ message: 'Render process started' });
|
res.json({ message: 'Render process started' });
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.error('Error getting path list:', err);
|
console.error('Error getting path list:', err);
|
||||||
res.status(500).json({ error: 'Error getting path list' });
|
res.status(500).json({ error: 'Error getting path list' });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const videoFile = createVideoWithList(project_id, pathList);
|
||||||
|
console.log('Video file:', videoFile);
|
||||||
|
|
||||||
|
try {
|
||||||
|
videoManager.updateVideoFile(videoId, videoFile);
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error updating video file:', err);
|
||||||
|
res.status(500).json({ error: 'Error updating video file' });
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -126,4 +126,12 @@ async function createVideo(projectId) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { createVideo, createVideoWithList, createVideoProject, deleteVideoProject };
|
async function updateVideoFile(videoId, path) {
|
||||||
|
const query = 'UPDATE public.videos SET video_file = $2 WHERE id = $1 RETURNING *';
|
||||||
|
const values = [videoId, path];
|
||||||
|
const res = await db.query(query, values);
|
||||||
|
console.log('Video updated:', res.rows[0]);
|
||||||
|
return res.rows[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { createVideo, createVideoWithList, createVideoProject, deleteVideoProject, updateVideoFile };
|
||||||
|
|||||||
Reference in New Issue
Block a user