This commit is contained in:
Luca Jäntsch 2017-09-29 14:20:55 +02:00 committed by Theenoro
parent 43fa503dcf
commit 3d5d5320bd
7 changed files with 16441 additions and 148 deletions

16192
package-lock.json generated

File diff suppressed because it is too large Load Diff

BIN
src/app.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -10,7 +10,7 @@
</script>
<!--<script src="./../libs/jquery/jquery-3.2.1.min.js"></script>
<script src="./../libs/bootstrap/js/bootstrap.js"></script>-->
<script src="./../libs/jquery/jquery-3.2.1.slim.min.js"></script>
<script src="./../libs/jquery/jquery-3.2.1.min.js"></script>
<script src="./../libs/popper.min.js"></script>
<script src="./../libs/bootstrap/bootstrap.min.js"></script>
<script src="./../js/player.js"></script>
@ -33,7 +33,9 @@
<div class="list-group" role="tablist" id="">
<li role="presentation" class="list-group-item list-group-item-action"><a href="#download" aria-controls="download" role="tab" data-toggle="tab">Download</a></li>
<li role="presentation" class="list-group-item list-group-item-action"><a href="#player" aria-controls="player" role="tab" data-toggle="tab">Player</a></li>
<li role="presentation" class="list-group-item list-group-item-action"><a href="#wt" aria-controls="wt" role="tab" data-toggle="tab">Watch Together</a></li>
<li role="presentation" class="list-group-item list-group-item-action"><a href="#info" aria-controls="info" role="tab" data-toggle="tab">Info</a></li>
</div>
</div>
</div>
@ -51,6 +53,7 @@
<div class="list-group" role="tablist">
<li role="presentation" class="list-group-item list-group-item-action"><a href="#download" aria-controls="download" role="tab" data-toggle="tab">Download</a></li>
<li role="presentation" class="list-group-item list-group-item-action"><a href="#player" aria-controls="player" role="tab" data-toggle="tab">Player</a></li>
<li role="presentation" class="list-group-item list-group-item-action"><a href="#wt" aria-controls="wt" role="tab" data-toggle="tab">Watch Together</a></li>
<li role="presentation" class="list-group-item list-group-item-action"><a href="#info" aria-controls="info" role="tab" data-toggle="tab">Info</a></li>
</div>
</div>
@ -127,6 +130,48 @@
</div>
</div>
</div>
<div role="tabpanel" class="tab-pane fade" id="wt">
<div class="row">
<div class="col-md-12">
<div class="input-group">
<input type="text" class="form-control" id="webview-url" placeholder="www..." aria-label="Product name">
<span class="input-group-btn">
<button class="btn btn-secondary" type="button" id="webviewload">-></button>
<button class="btn btn-secondary" type="button" id="webviewdownload">Cyb3r Download</button>
</span>
</div>
<webview id="foo" src="https://youtube.com/" style="display:inline-flex; width:100%; height:calc(100vh - 144px)"></webview>
</div>
<script>
$(function(){
const webview = document.querySelector('webview')
const indicator = document.querySelector('.indicator')
const loadstart = () => {
console.log('LEL');
}
const loadstop = () => {
$('#webview-url').val(webview.getURL());
console.log('stop');
}
$('#webviewload').click(()=>{
var url = $('#webview-url').val();
webview.loadURL(url)
})
$('#webviewdownload').click(()=>{
var url = $('#webview-url').val();
$.post( "http://127.0.0.1:54167/download?url="+encodeURI(url),function() {
});
})
webview.addEventListener('did-start-loading', loadstart)
webview.addEventListener('did-stop-loading', loadstop)
});
</script>
</div>
</div>
<div role="tabpanel" class="tab-pane fade" id="info">
<div class="row">
<div class="col-md-12">
@ -134,6 +179,7 @@
<a href="https://git.tooru.thee.moe/theenoro/electron-simple-youtube-downloader" target="_blank">Git</a>
</div>
</div>
</div>
</div>

View File

@ -1,7 +1,8 @@
const request = require('request');
const fs = require('fs')
const ipcMain = require('electron').ipcMain;
const unzip = require('unzip')
const unzip = require('unzip');
const { spawn } = require('child_process');
var libsx = {
@ -27,6 +28,7 @@ ipcMain
break;
default:
}
for (var lib in libsx) {
if (fs.existsSync(global.dir+"/lib/"+libsx[lib])) {
@ -41,6 +43,8 @@ ipcMain
if(url === ''){
libs.checkNext('youtube-dl');
}else{
switch(process.platform){
case "win32":
libs.download(url,"ffmpeg",function(data,file){
fs.createReadStream(file)
.pipe(unzip.Parse())
@ -61,6 +65,43 @@ ipcMain
}
});
});
break;
case "linux":
libs.download(url,"ffmpeg",function(data,file){
const ls = spawn('tar', ['xvf','./src/tmp/ffmpeg.x-xz','-C','./src/tmp']);
ls.stdout.on('data', (data) => {
console.log(`stdout: ${data}`);
});
ls.stderr.on('data', (data) => {
console.log(`stderr: ${data}`);
});
ls.on('close', (code) => {
var folder = "";
console.log(`child process exited with code ${code}`);
const ls = spawn('rm', ['./src/tmp/ffmpeg.x-xz']).on('close',()=>{
const ls = spawn('ls', ['./src/tmp/']).stdout.on(data,(data)=>{
console.log(data)
if(data.match('ffmpeg-') && data.match('-static')){
folder = data;
}
}).on('close',()=>{
const ls = spawn('cp', ['./src/tmp/'+folder+'/ffmpeg','./src/lib/ffmpeg']).on('close',()=>{
const ls = spawn('cp', ['./src/tmp/'+folder+'/ffprobe','./src/lib/ffprobe']).on('close',()=>{
libs.checkNext('youtube-dl');
});
});
});
});
});
})
break;
default:
}
}
}else{
libs.checkNext('youtube-dl');
@ -86,7 +127,7 @@ libs.ff = (os)=>{
url = 'http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-latest-win32-static.zip';
break;
case "linux":
url = ''
url = 'https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-64bit-static.tar.xz'
default:
@ -104,8 +145,11 @@ libs.yt_dl = (os,cb)=>{
})
break;
case "linux":
url = ''
url = 'https://yt-dl.org/downloads/latest/youtube-dl'
libs.download(url,"youtube-dl",function(data,file){
fs.renameSync(file,global.dir+'/lib/youtube-dl');
cb();
})
default:
}
@ -133,6 +177,8 @@ libs.download = (url,data,cb)=>{
});
}
function win_ffmpeg(){
}
module.exports = libs;

View File

@ -1,12 +1,20 @@
const {app, Menu, Tray} = require('electron')
const main_window = require('./windows.js/main.js')
const path = require('path')
module.exports = ()=>{
switch(process.platform){
case 'win32':
let tray = new Tray(global.dir+'/app.ico')
break;
case 'linux':
break;
}
let tray = new Tray(path.join(global.dir+'/app.png'))
const contextMenu = Menu.buildFromTemplate([
{label: 'Open', click(){ main_window.open() }},
/*{label: 'About',click() { console.log('item 1 clicked') }},

1
src/tmp/inst Normal file
View File

@ -0,0 +1 @@
out