modified: src/lib.js

This commit is contained in:
Flummi 2016-09-11 17:55:04 +02:00
parent da6e2acc1d
commit 9015070042

View File

@ -110,11 +110,10 @@ Lib.prototype.generateThumbs = () => {
case "audio/mpeg": case "audio/mpeg":
case "audio/ogg": case "audio/ogg":
case "image/gif": 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; break;
case "image/png": case "image/png":
case "image/jpeg": 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; cmd = 'convert '+e.dest+' -resize "200x200^" -gravity center -crop 128x128+0+0 +repage '+thumbnail;
break; 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) => { Lib.prototype.log = (msg) => {
if(Lib.prototype.debug) if(Lib.prototype.debug)
bot.send(Lib.prototype.cfg.debugchannel, msg, 'n0xy'); bot.send(Lib.prototype.cfg.debugchannel, msg, 'n0xy');
}; };
Lib.prototype.loadTrigger = () => { Lib.prototype.loadTrigger = () => {
var files = fs.readdirSync(__dirname+'/trigger/'); var files = fs.readdirSync(__dirname+'/trigger/');
files.forEach((file) => { files.forEach((file) => {