Files

34 lines
1.4 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getOutputFilename = void 0;
const renderer_1 = require("@remotion/renderer");
const log_1 = require("./log");
const user_passed_output_location_1 = require("./user-passed-output-location");
const getOutputFilename = ({ imageSequence, compositionName, compositionDefaultOutName, defaultExtension, args, fromUi, indent, logLevel, }) => {
if (fromUi) {
return fromUi;
}
const filename = (0, user_passed_output_location_1.getOutputLocation)({
compositionId: compositionName,
defaultExtension,
args,
type: imageSequence ? 'sequence' : 'asset',
outputLocationFromUi: null,
compositionDefaultOutName,
});
const extension = renderer_1.RenderInternals.getExtensionOfFilename(String(filename));
if (imageSequence) {
if (extension !== null) {
throw new Error('The output directory of the image sequence cannot have an extension. Got: ' +
extension);
}
return String(filename);
}
if (extension === null && !imageSequence) {
log_1.Log.warn({ indent, logLevel }, `No file extension specified, adding ${defaultExtension} automatically.`);
return `${filename}.${defaultExtension}`;
}
return String(filename);
};
exports.getOutputFilename = getOutputFilename;