thumbnailfix

This commit is contained in:
Flummi 2016-09-11 22:12:03 +02:00
parent 9015070042
commit 9778c4f7ec

View File

@ -110,23 +110,31 @@ Lib.prototype.generateThumbs = () => {
case "audio/mpeg": case "audio/mpeg":
case "audio/ogg": case "audio/ogg":
case "image/gif": case "image/gif":
cmd = 'ffmpeg -ss 2 -i '+e.dest+' -vframes 1 -filter "scale=-1:256,crop=128:128" '+thumbnail; exec('ffmpegthumbnailer -i'+e.dest+' -s1024 -o'+thumbnail, (error) => {
break;
case "image/png":
case "image/jpeg":
cmd = 'convert '+e.dest+' -resize "200x200^" -gravity center -crop 128x128+0+0 +repage '+thumbnail;
break;
}
exec(cmd, (error) => {
if(error) { if(error) {
Lib.prototype.log('failed thumbnail for '+e.id+' ('+e.mime+') '+JSON.stringify(error)); Lib.prototype.log('failed thumbnail for '+e.id+' ('+e.mime+')');
fs.copySync('./s/mp3.png', thumbnail); // copy standardthumbnail 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 else
Lib.prototype.log("generated thumbnail for "+e.id+" ("+e.mime+")"); Lib.prototype.log("generated thumbnail for "+e.id+" ("+e.mime+")");
}); });
} }
}); });
break;
case "image/png":
case "image/jpeg":
exec('convert '+e.dest+' -resize "200x200^" -gravity center -crop 128x128+0+0 +repage '+thumbnail, (error) => {
Lib.prototype.log((error)?'failed thumbnail for '+e.id+' ('+e.mime+')':'generated thumbnail for '+e.id+' ('+e.mime+')');
});
break;
}
}
});
}); });
}; };
Lib.prototype.log = (msg) => { Lib.prototype.log = (msg) => {