fucking youtubeapi
This commit is contained in:
parent
c6798f7a08
commit
d8c4da9aba
18
src/lib.js
18
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+')');
|
||||
});
|
||||
});
|
||||
}
|
||||
}*/
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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) );
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user