Added WMA
This commit is contained in:
parent
b5b992e568
commit
8c48ace39e
638
package-lock.json
generated
638
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -57,8 +57,16 @@ $(function() {
|
|||||||
});
|
});
|
||||||
ipcRenderer.on('process-fin', function(event, arg) {
|
ipcRenderer.on('process-fin', function(event, arg) {
|
||||||
console.log(arg); // prints "pong"
|
console.log(arg); // prints "pong"
|
||||||
$('#download-progress-' + arg.id).css("width", arg.percent);
|
if(arg.percent==101){
|
||||||
$('#download-progress-' + arg.id).html("CONVERTED");
|
$('#download-progress-' + arg.id).css("width", 100);
|
||||||
|
$('#download-progress-' + arg.id).html("CONVERTING");
|
||||||
|
}else{
|
||||||
|
$('#download-progress-' + arg.id).css("width", arg.percent);
|
||||||
|
$('#download-progress-' + arg.id).html("CONVERTED");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
ipcRenderer.on('file', function(event, arg) {
|
ipcRenderer.on('file', function(event, arg) {
|
||||||
console.log('DOWNLOADED')
|
console.log('DOWNLOADED')
|
||||||
|
@ -98,6 +98,7 @@
|
|||||||
|
|
||||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
|
<div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
|
||||||
<a class="dropdown-item format" href="#" data-format="mp3">MP3</a>
|
<a class="dropdown-item format" href="#" data-format="mp3">MP3</a>
|
||||||
|
<a class="dropdown-item format" href="#" data-format="wma">WMA</a>
|
||||||
<div class="dropdown-divider"></div>
|
<div class="dropdown-divider"></div>
|
||||||
<a class="dropdown-item format" href="#" data-format="mp4">MP4</a>
|
<a class="dropdown-item format" href="#" data-format="mp4">MP4</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -127,14 +127,42 @@ var yt_dl = class{
|
|||||||
});
|
});
|
||||||
ls.on('close', (code) => {
|
ls.on('close', (code) => {
|
||||||
console.log(`child process exited with code ${code}`);
|
console.log(`child process exited with code ${code}`);
|
||||||
me.lwrite.sender.send('file',{id:me.id,file:log[log.length-2].split('[ffmpeg] Destination: ')[1]});
|
|
||||||
me.lwrite.sender.send('process-fin',{percent :me.percent,id:me.id});
|
switch(format){
|
||||||
|
case "wma":
|
||||||
|
me.lwrite.sender.send('process-fin',{percent :101,id:me.id});
|
||||||
|
setTimeout(function(){
|
||||||
|
var fo = log[log.length-2].split('[ffmpeg] Destination: ')[1].replace(/\\/g,'/').trim();
|
||||||
|
var f = fo.replace('.mp3','.'+format);
|
||||||
|
console.log(f)
|
||||||
|
const bat = spawn(global.dir+'/lib/ffmpeg', ['-i',fo,f,'-loglevel','repeat+level+verbose']);
|
||||||
|
console.dir(bat)
|
||||||
|
bat.stdout.on('data', (data) => {
|
||||||
|
console.log(data.toString());
|
||||||
|
});
|
||||||
|
|
||||||
|
bat.stderr.on('data', (data) => {
|
||||||
|
console.log(data.toString());
|
||||||
|
});
|
||||||
|
|
||||||
|
bat.on('exit', (code) => {
|
||||||
|
console.log(`Child exited with code ${code}`);
|
||||||
|
me.lwrite.sender.send('file',{id:me.id,file:log[log.length-2].split('[ffmpeg] Destination: ')[1]});
|
||||||
|
me.lwrite.sender.send('process-fin',{percent :me.percent,id:me.id});
|
||||||
|
});
|
||||||
|
},2000)
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
me.lwrite.sender.send('file',{id:me.id,file:log[log.length-2].split('[ffmpeg] Destination: ')[1]});
|
||||||
|
me.lwrite.sender.send('process-fin',{percent :me.percent,id:me.id});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* if(this.url.match('youtube')){
|
||||||
if(this.url.match('youtube')){
|
|
||||||
var url = this.url;
|
var url = this.url;
|
||||||
var video_id = this.url.split('v=')[1];
|
var video_id = this.url.split('v=')[1];
|
||||||
var ampersandPosition = video_id.indexOf('&');
|
var ampersandPosition = video_id.indexOf('&');
|
||||||
@ -157,9 +185,9 @@ var yt_dl = class{
|
|||||||
image: body
|
image: body
|
||||||
}
|
}
|
||||||
var success = nodeID3.write(tags, log[log.length-2].split('[ffmpeg] Destination: ')[1]);
|
var success = nodeID3.write(tags, log[log.length-2].split('[ffmpeg] Destination: ')[1]);
|
||||||
console.log(success);*/
|
console.log(success);
|
||||||
//});
|
});
|
||||||
}
|
}*/
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,9 @@ module.exports = (path,url,format)=>{
|
|||||||
case "mp3":
|
case "mp3":
|
||||||
param = ['-x','--audio-format','mp3','-i',url,'-o',path+'/%(title)s.%(ext)s'];
|
param = ['-x','--audio-format','mp3','-i',url,'-o',path+'/%(title)s.%(ext)s'];
|
||||||
break;
|
break;
|
||||||
|
case "wma":
|
||||||
|
param = ['-x','--audio-format','mp3','-i',url,'-o',path+'/%(title)s.%(ext)s'];
|
||||||
|
break;
|
||||||
case "mp4":
|
case "mp4":
|
||||||
param = ['-w','-f','bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4',url,'-o',path+'/%(title)s.%(ext)s'];
|
param = ['-w','-f','bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4',url,'-o',path+'/%(title)s.%(ext)s'];
|
||||||
break;
|
break;
|
||||||
|
1
src/tmp/inst
Normal file
1
src/tmp/inst
Normal file
@ -0,0 +1 @@
|
|||||||
|
out
|
Loading…
Reference in New Issue
Block a user