1.3.2
This commit is contained in:
@@ -4,6 +4,7 @@ console.log(global.dir);
|
||||
|
||||
var orig_path = "";
|
||||
var path = "";
|
||||
var format = "mp3";
|
||||
|
||||
ipcMain
|
||||
.on('start-download', (event, arg)=>{
|
||||
@@ -12,6 +13,9 @@ ipcMain
|
||||
download.addListen(event)
|
||||
download.download();
|
||||
})
|
||||
.on('set-format',(event,arg)=>{
|
||||
format = arg.format;
|
||||
})
|
||||
.on('start-download-pl', (event, arg)=>{
|
||||
var mkdirp = require('mkdirp');
|
||||
if(orig_path === ""){
|
||||
@@ -50,10 +54,20 @@ var yt_dl = class{
|
||||
var log = [];
|
||||
var me = this;
|
||||
var ls;
|
||||
switch (format) {
|
||||
case "mp3":
|
||||
ls = spawn(global.dir+'/lib/youtube-dl', ['-x','--audio-format','mp3','-i',this.url,'-o',path+'/%(title)s.%(ext)s']);
|
||||
break;
|
||||
case "mp4":
|
||||
ls = spawn(global.dir+'/lib/youtube-dl', ['-f','bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4',this.url,'-o',path+'/%(title)s.%(ext)s']);
|
||||
break;
|
||||
default:
|
||||
|
||||
}
|
||||
if(path == ''){
|
||||
ls = spawn(global.dir+'/lib/youtube-dl', ['-x','--audio-format','mp3','-i',this.url]);
|
||||
//ls = spawn(global.dir+'/lib/youtube-dl', ['-x','--audio-format','mp3','-i',this.url]);
|
||||
}else{
|
||||
ls = spawn(global.dir+'/lib/youtube-dl', ['-x','--audio-format','mp3','-i',this.url,'-o',path+'/%(title)s.%(ext)s']);
|
||||
//ls = spawn(global.dir+'/lib/youtube-dl', ['-x','--audio-format','mp3','-i',this.url,'-o',path+'/%(title)s.%(ext)s']);
|
||||
}
|
||||
|
||||
ls.stdout.on('data', (data) => {
|
||||
|
||||
Reference in New Issue
Block a user