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) => {
|
rows.forEach((e,i,a) => {
|
||||||
var thumbnail = outdir+'/'+e.id+'.png';
|
var thumbnail = outdir+'/'+e.id+'.png';
|
||||||
if(!fs.existsSync(thumbnail)) {
|
if(!fs.existsSync(thumbnail)) {
|
||||||
if(e.thumb == '') {
|
//if(e.thumb == '') {
|
||||||
var cmd;
|
var cmd;
|
||||||
switch(e.mime) {
|
switch(e.mime) {
|
||||||
case "video/mp4":
|
case "video/mp4":
|
||||||
|
@ -102,16 +102,16 @@ self.generateThumbs = () => {
|
||||||
case "video/quicktime":
|
case "video/quicktime":
|
||||||
case "audio/mpeg":
|
case "audio/mpeg":
|
||||||
case "audio/ogg":
|
case "audio/ogg":
|
||||||
case "audio/flac":
|
case "audio/flac":
|
||||||
case "audio/x-flac":
|
case "audio/x-flac":
|
||||||
case "image/gif":
|
case "image/gif":
|
||||||
exec('ffmpegthumbnailer -i'+e.dest+' -s1024 -o'+thumbnail, (error) => {
|
exec('ffmpegthumbnailer -i'+e.dest+' -s1024 -o'+thumbnail, (error) => {
|
||||||
if(error) {
|
if(error) {
|
||||||
self.log('failed thumbnail for '+e.id+' ('+e.mime+')');
|
self.log('failed thumbnail for '+e.id+' ('+e.mime+')');
|
||||||
if(e.mime.match(/audio/i))
|
if(e.mime.match(/audio/i))
|
||||||
fs.copySync('./s/mp3.png', thumbnail); // copy standardthumbnail
|
fs.copySync('./s/mp3.png', thumbnail); // copy standardthumbnail
|
||||||
else
|
else
|
||||||
fs.copySync('./s/f0ck.png', thumbnail);
|
fs.copySync('./s/f0ck.png', thumbnail);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
exec('convert '+thumbnail+' -resize "128x128^" -gravity center -crop 128x128+0+0 +repage '+thumbnail, (error) => {
|
exec('convert '+thumbnail+' -resize "128x128^" -gravity center -crop 128x128+0+0 +repage '+thumbnail, (error) => {
|
||||||
|
@ -128,7 +128,7 @@ self.generateThumbs = () => {
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
/*}
|
||||||
else {
|
else {
|
||||||
var dat = fs.createWriteStream(thumbnail);
|
var dat = fs.createWriteStream(thumbnail);
|
||||||
request(e.thumb).pipe(dat);
|
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+')');
|
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',
|
name: 'thumbnailer',
|
||||||
call: /^\!thumb(.*\d+)?$/i,
|
call: /^\!thumb(.*\d+)?$/i,
|
||||||
level: 100,
|
level: 100,
|
||||||
active: 0,
|
active: 1,
|
||||||
func: (e) => {
|
func: (e) => {
|
||||||
var id;
|
var id;
|
||||||
if(id = e.message.split(' ')[1]) {
|
if(id = e.message.split(' ')[1]) {
|
||||||
if(Number.isInteger(parseInt(id)))
|
if(Number.isInteger(parseInt(id)))
|
||||||
fs.unlink('./t/'+id+'.png', () => lib.generateThumbs() );
|
fs.unlink('./t/'+id+'.png', () => lib.generateThumbs() );
|
||||||
}
|
}
|
||||||
else {
|
/*else {
|
||||||
deleteFolderRecursive('./t');
|
deleteFolderRecursive('./t');
|
||||||
lib.generateThumbs();
|
lib.generateThumbs();
|
||||||
}
|
}*/
|
||||||
},
|
},
|
||||||
desc: 'generate thumbnail'
|
desc: 'generate thumbnail'
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user