From 901507004291a0e3fa866095d023020528e4eb5d Mon Sep 17 00:00:00 2001 From: Flummi Date: Sun, 11 Sep 2016 17:55:04 +0200 Subject: [PATCH] modified: src/lib.js --- src/lib.js | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/src/lib.js b/src/lib.js index 60a6253..fd7dbf6 100644 --- a/src/lib.js +++ b/src/lib.js @@ -110,11 +110,10 @@ Lib.prototype.generateThumbs = () => { case "audio/mpeg": case "audio/ogg": case "image/gif": - cmd = 'ffmpeg -i '+e.dest+' -vframes 1 -filter "scale=-1:256,crop=128:128" '+thumbnail; + cmd = 'ffmpeg -ss 2 -i '+e.dest+' -vframes 1 -filter "scale=-1:256,crop=128:128" '+thumbnail; break; case "image/png": case "image/jpeg": - //cmd = 'convert -thumbnail 256x256 '+e.dest+' -gravity center -crop 128x128+0+0 +repage '+thumbnail; cmd = 'convert '+e.dest+' -resize "200x200^" -gravity center -crop 128x128+0+0 +repage '+thumbnail; break; } @@ -130,35 +129,10 @@ Lib.prototype.generateThumbs = () => { }); }); }; -/*Lib.prototype.generateThumbs = () => { - var outdir = './t/'; - Lib.prototype.sql.query("select * from `f0ck`.`items`", (err, rows, fields) => { - rows.forEach((e,i,a) => { - var thumbnail = outdir+e.id+'.png'; - if(!fs.existsSync(thumbnail)) { - exec('ffmpegthumbnailer -i'+e.dest+' -s1024 -o'+thumbnail, (error) => { - if(error) { - Lib.prototype.log('failed thumbnail for '+e.id+' ('+e.mime+') '+JSON.stringify(error)); - fs.copySync('./s/mp3.png', thumbnail); // copy standardthumbnail - } - else { - exec('convert '+thumbnail+' -resize "128x128^" -gravity center -crop 128x128+0+0 +repage '+thumbnail, (error) => { - if(error) - Lib.prototype.log('failed thumbnail for '+e.id+' ('+e.mime+') 2'); - else - Lib.prototype.log("generated thumbnail for "+e.id+" ("+e.mime+")"); - }); - } - }); - } - }); - }); -};*/ Lib.prototype.log = (msg) => { if(Lib.prototype.debug) bot.send(Lib.prototype.cfg.debugchannel, msg, 'n0xy'); }; - Lib.prototype.loadTrigger = () => { var files = fs.readdirSync(__dirname+'/trigger/'); files.forEach((file) => {