Fix orphan check at startup
parent
a02313ba77
commit
a45118c977
|
@ -57,12 +57,15 @@ module.exports = function(s,config){
|
||||||
splitted[1] = user + ':' + pass + '@' + splitted[1]
|
splitted[1] = user + ':' + pass + '@' + splitted[1]
|
||||||
return splitted.join('://')
|
return splitted.join('://')
|
||||||
}
|
}
|
||||||
s.checkCorrectPathEnding = function(x){
|
s.checkCorrectPathEnding = function(x,reverse){
|
||||||
var length=x.length
|
var newString = `${x}`
|
||||||
if(x.charAt(length-1)!=='/'){
|
var length = x.length
|
||||||
x=x+'/'
|
if(reverse && x.charAt(length-1) === '/'){
|
||||||
|
newString = x.slice(0, -1)
|
||||||
|
}else if(x.charAt(length-1) !== '/'){
|
||||||
|
newString = x + '/'
|
||||||
}
|
}
|
||||||
return x.replace('__DIR__',s.mainDirectory)
|
return newString.replace('__DIR__',s.mainDirectory)
|
||||||
}
|
}
|
||||||
s.mergeDeep = function(...objects) {
|
s.mergeDeep = function(...objects) {
|
||||||
const isObject = obj => obj && typeof obj === 'object';
|
const isObject = obj => obj && typeof obj === 'object';
|
||||||
|
|
|
@ -62,7 +62,7 @@ module.exports = (s,config,lang) => {
|
||||||
// const findCmd = [videosDirectory].concat(options.flags || ['-maxdepth','1'])
|
// const findCmd = [videosDirectory].concat(options.flags || ['-maxdepth','1'])
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(
|
||||||
tempDirectory + 'orphanCheck.sh',
|
tempDirectory + 'orphanCheck.sh',
|
||||||
`find "${videosDirectory}" -maxdepth 1 -type f -exec stat -c "%n" {} + | sort -r | head -n ${options.checkMax}`
|
`find "${s.checkCorrectPathEnding(videosDirectory,true)}" -maxdepth 1 -type f -exec stat -c "%n" {} + | sort -r | head -n ${options.checkMax}`
|
||||||
);
|
);
|
||||||
let listing = spawn('sh',[tempDirectory + 'orphanCheck.sh'])
|
let listing = spawn('sh',[tempDirectory + 'orphanCheck.sh'])
|
||||||
// const onData = options.onData ? options.onData : () => {}
|
// const onData = options.onData ? options.onData : () => {}
|
||||||
|
|
Loading…
Reference in New Issue