Mark van Renswoude
dd75bef94f
Added raw and mjpeg-split output modules Added before/after/during commands Updated sample config and added readme
34 lines
660 B
JavaScript
34 lines
660 B
JavaScript
var path = require('path');
|
|
var mkdirp = require('mkdirp');
|
|
|
|
|
|
function parseVariables(value, now, variables)
|
|
{
|
|
for (var variable in variables)
|
|
{
|
|
if (variables.hasOwnProperty(variable))
|
|
{
|
|
value = value.replace('<' + variable + '>', variables[variable].toString());
|
|
}
|
|
}
|
|
|
|
value = now.format(value);
|
|
return value;
|
|
}
|
|
|
|
|
|
function createVariableFilename(value, now, variables)
|
|
{
|
|
var filename = parseVariables(value, now, variables);
|
|
var dirname = path.dirname(filename);
|
|
mkdirp.sync(dirname);
|
|
|
|
return filename;
|
|
}
|
|
|
|
|
|
module.exports =
|
|
{
|
|
parseVariables: parseVariables,
|
|
createVariableFilename: createVariableFilename
|
|
}; |