Added filepath component length limit with truncator. Fixed double extension dot when copying original extension. Moved API keys to local config.

This commit is contained in:
2018-05-23 17:03:12 +02:00
parent 6f306322c6
commit 569213e291
4 changed files with 20 additions and 11 deletions

View File

@@ -1,10 +1,19 @@
'use strict';
const config = require('config');
const fs = require('fs-extra');
const path = require('path');
const ffmpeg = require('fluent-ffmpeg');
function save(filepath, streams, item, post) {
function save(requestedFilepath, streams, item, post) {
const filepath = requestedFilepath.split('/').map(component => {
if(config.library.truncate && component.length > config.library.truncate.limit) {
return component.slice(0, config.library.truncate.limit - config.library.truncate.truncator.length) + config.library.truncate.truncator;
}
return component;
}).join(path.sep);
const pathComponents = path.parse(filepath);
// allow for single stream argument