diff --git a/src/lib.js b/src/lib.js index 93a8763..89d7a43 100644 --- a/src/lib.js +++ b/src/lib.js @@ -94,7 +94,7 @@ self.generateThumbs = () => { rows.forEach((e,i,a) => { var thumbnail = outdir+'/'+e.id+'.png'; if(!fs.existsSync(thumbnail)) { - if(e.thumb == '') { + //if(e.thumb == '') { var cmd; switch(e.mime) { case "video/mp4": @@ -102,16 +102,16 @@ self.generateThumbs = () => { case "video/quicktime": case "audio/mpeg": case "audio/ogg": - case "audio/flac": - case "audio/x-flac": + case "audio/flac": + case "audio/x-flac": case "image/gif": exec('ffmpegthumbnailer -i'+e.dest+' -s1024 -o'+thumbnail, (error) => { if(error) { self.log('failed thumbnail for '+e.id+' ('+e.mime+')'); - if(e.mime.match(/audio/i)) - fs.copySync('./s/mp3.png', thumbnail); // copy standardthumbnail - else - fs.copySync('./s/f0ck.png', thumbnail); + if(e.mime.match(/audio/i)) + fs.copySync('./s/mp3.png', thumbnail); // copy standardthumbnail + else + fs.copySync('./s/f0ck.png', thumbnail); } else exec('convert '+thumbnail+' -resize "128x128^" -gravity center -crop 128x128+0+0 +repage '+thumbnail, (error) => { @@ -128,7 +128,7 @@ self.generateThumbs = () => { }); break; } - } + /*} else { var dat = fs.createWriteStream(thumbnail); request(e.thumb).pipe(dat); @@ -139,7 +139,7 @@ self.generateThumbs = () => { self.log((error)?'failed thumbnail for '+e.id+' ('+e.mime+')':'generated thumbnail for '+e.id+' ('+e.mime+')'); }); }); - } + }*/ } }); }); diff --git a/src/trigger/thumb.js b/src/trigger/thumb.js index 9fdcf33..4ead7b7 100644 --- a/src/trigger/thumb.js +++ b/src/trigger/thumb.js @@ -5,17 +5,17 @@ module.exports = (lib) => { name: 'thumbnailer', call: /^\!thumb(.*\d+)?$/i, level: 100, - active: 0, + active: 1, func: (e) => { var id; if(id = e.message.split(' ')[1]) { if(Number.isInteger(parseInt(id))) fs.unlink('./t/'+id+'.png', () => lib.generateThumbs() ); } - else { + /*else { deleteFolderRecursive('./t'); lib.generateThumbs(); - } + }*/ }, desc: 'generate thumbnail' }); @@ -24,4 +24,4 @@ module.exports = (lib) => { var deleteFolderRecursive = (path) => { if(fs.existsSync(path)) fs.readdirSync(path).forEach((file,index) => (fs.lstatSync(path+"/"+file).isDirectory())?deleteFolderRecursive(path+"/"+file):fs.unlinkSync(path+"/"+file) ); -}; \ No newline at end of file +};