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

View File

@ -56,17 +56,17 @@
}
},
"dependencies": {
"body-parser": "^1.17.2",
"cors": "^2.8.4",
"electron": "^1.7.6",
"electron-config": "^1.0.0",
"express": "^4.15.4",
"fs": "0.0.1-security",
"mkdirp": "^0.5.1",
"node-id3": "0.0.10",
"path": "^0.12.7",
"request": "^2.81.0",
"unzip": "^0.1.11",
"watchr": "^3.0.1"
}
"body-parser": "^1.17.2",
"cors": "^2.8.4",
"electron": "^1.7.6",
"electron-config": "^1.0.0",
"express": "^4.15.4",
"fs": "0.0.1-security",
"mkdirp": "^0.5.1",
"node-id3": "0.0.10",
"path": "^0.12.7",
"request": "^2.81.0",
"unzip": "^0.1.11",
"watchr": "^3.0.1"
}
}

BIN
src/app.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -2,62 +2,65 @@
<html>
<head>
<script>
if (typeof module === 'object') {
window.module = module;
module = undefined;
}
</script>
<!--<script src="./../libs/jquery/jquery-3.2.1.min.js"></script>
<script>
if (typeof module === 'object') {
window.module = module;
module = undefined;
}
</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/popper.min.js"></script>
<script src="./../libs/bootstrap/bootstrap.min.js"></script>
<script src="./../js/player.js"></script>
<meta charset="utf-8">
<title>Cyb3r Downloader</title>
<!--<link rel="stylesheet" href="./../libs/bootstrap/css/bootstrap.css" />
<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>
<meta charset="utf-8">
<title>Cyb3r Downloader</title>
<!--<link rel="stylesheet" href="./../libs/bootstrap/css/bootstrap.css" />
<link rel="stylesheet" href="./../libs/bootstrap/css/bootstrap-theme.css" />-->
<link rel="stylesheet" href="./../libs/bootstrap/bootstrap.min.css">
<link rel="stylesheet" href="./../libs/font-awesome/css/font-awesome.min.css" />
<link rel="stylesheet" href="./../libs/bootstrap/bootstrap.min.css">
<link rel="stylesheet" href="./../libs/font-awesome/css/font-awesome.min.css" />
<link rel="stylesheet" href="./../style/bootstrap.min.css" />
<link rel="stylesheet" href="./../style/style.css" />
<link rel="stylesheet" href="./../style/player.css" />
<link rel="stylesheet" href="./../style/bootstrap.min.css" />
<link rel="stylesheet" href="./../style/style.css" />
<link rel="stylesheet" href="./../style/player.css" />
</head>
<body>
<div class="container-fluid">
<div class="collapse" id="navigota" style=" position: fixed; top: 56px; left: 0px;z-index: 999999;">
<div class="bg-dark p-4">
<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="#info" aria-controls="info" role="tab" data-toggle="tab">Info</a></li>
</div>
</div>
<div class="container-fluid">
<div class="collapse" id="navigota" style=" position: fixed; top: 56px; left: 0px;z-index: 999999;">
<div class="bg-dark p-4">
<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>
<nav class="navbar fixed-top navbar-dark bg-dark justify-content-between" style="-webkit-app-region: drag">
<button id="togmenu" style="-webkit-app-region: no-drag;" class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navigota" aria-controls="navbarToggleExternalContent" aria-expanded="false" aria-label="Toggle navigation">
</div>
</div>
<nav class="navbar fixed-top navbar-dark bg-dark justify-content-between" style="-webkit-app-region: drag">
<button id="togmenu" style="-webkit-app-region: no-drag;" class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navigota" aria-controls="navbarToggleExternalContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand">Cyb3r Downloader</a>
<form class="form-inline">
<button class="btn btn-outline-success my-2 my-sm-0" id="close" style="-webkit-app-region: no-drag;">X</button>
</form>
</nav>
<div class="row">
<div class="col-md-2" style="display:none">
<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="#info" aria-controls="info" role="tab" data-toggle="tab">Info</a></li>
</div>
</div>
<div class="col-md-12" >
<div style="max-width:380px;margin:auto;margin-bottom:25px;">
<a class="navbar-brand">Cyb3r Downloader</a>
<form class="form-inline">
<button class="btn btn-outline-success my-2 my-sm-0" id="close" style="-webkit-app-region: no-drag;">X</button>
</form>
</nav>
<div class="row">
<div class="col-md-2" style="display:none">
<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>
<div class="col-md-12">
<div style="max-width:380px;margin:auto;margin-bottom:25px;">
<div style=" margin: 0;
<div style=" margin: 0;
padding: 0;
height: 35px;
display: flex;
@ -69,28 +72,28 @@
box-shadow: 0px -1px 8px 4px rgba(69, 69, 69, 0.18);
z-index:99999999;
">
<button class="btn nabbar-btn btn-link" style="margin:0;" id="play"><i class="fa fa-pause-circle-o" aria-hidden="true"></i></button>
<div id="time">
<span></span>
</div>
<button class="btn nabbar-btn btn-link" style="margin:0;"><i class="fa fa-volume-up" aria-hidden="true"></i></button>
<div id="volume">
<span></span>
</div>
<button class="btn nabbar-btn btn-link" id="pot" style="margin:0;"><i class="fa fa-window-restore" aria-hidden="true"></i></button>
</div>
</div>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="download">
<input id="business" type="file" style="display: none" />
<div class="row">
<div class="col-md-12">
<div class="input-group">
<span class="input-group-btn">
<button class="btn nabbar-btn btn-link" style="margin:0;" id="play"><i class="fa fa-pause-circle-o" aria-hidden="true"></i></button>
<div id="time">
<span></span>
</div>
<button class="btn nabbar-btn btn-link" style="margin:0;"><i class="fa fa-volume-up" aria-hidden="true"></i></button>
<div id="volume">
<span></span>
</div>
<button class="btn nabbar-btn btn-link" id="pot" style="margin:0;"><i class="fa fa-window-restore" aria-hidden="true"></i></button>
</div>
</div>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="download">
<input id="business" type="file" style="display: none" />
<div class="row">
<div class="col-md-12">
<div class="input-group">
<span class="input-group-btn">
<button id="party" class="btn btn-secondary" type="button">Select Folder</button>
</span>
<input type="text" class="form-control" id="url" placeholder="YT-Url" aria-label="Product name">
<span class="input-group-btn">
<input type="text" class="form-control" id="url" placeholder="YT-Url" aria-label="Product name">
<span class="input-group-btn">
<div class="dropdown show">
<a class="btn btn-secondary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Format
@ -103,59 +106,102 @@
</div>
</div>
</span>
<span class="input-group-btn">
<span class="input-group-btn">
<button class="btn btn-secondary" type="button" id="start-download">Download</button>
</span>
</div>
</div>
</div>
<div class="row scroll">
<div class="col-md-12" id="output">
</div>
</div>
</div>
<div role="tabpanel" class="tab-pane fade" id="player">
<div class="row">
<div class="col-md-12">
<div class="embed-responsive embed-responsive-16by9">
<video id="video"></video>
</div>
<div id="watchr_files">
</div>
</div>
</div>
</div>
<div role="tabpanel" class="tab-pane fade" id="info">
<div class="row">
<div class="col-md-12">
<h1>Info</h1>
<a href="https://git.tooru.thee.moe/theenoro/electron-simple-youtube-downloader" target="_blank">Git</a>
</div>
</div>
</div>
</div>
</div>
</div>
<!--<div class="col-md-4">
<div class="row scroll">
<div class="col-md-12" id="output">
</div>
</div>
</div>
<div role="tabpanel" class="tab-pane fade" id="player">
<div class="row">
<div class="col-md-12">
<div class="embed-responsive embed-responsive-16by9">
<video id="video"></video>
</div>
<div id="watchr_files">
</div>
</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">
<h1>Info</h1>
<a href="https://git.tooru.thee.moe/theenoro/electron-simple-youtube-downloader" target="_blank">Git</a>
</div>
</div>
</div>
</div>
</div>
<!--<div class="col-md-4">
<div class="left-playlist">
</div>
</div>-->
</div>
</div>
<script src="./../js/app.js"></script>
<script>
document.addEventListener("keydown", function (e) {
if (e.which === 123) {
require('remote').getCurrentWindow().toggleDevTools();
} else if (e.which === 116) {
location.reload();
}
});
</script>
</div>
<script src="./../js/app.js"></script>
<script>
document.addEventListener("keydown", function(e) {
if (e.which === 123) {
require('remote').getCurrentWindow().toggleDevTools();
} else if (e.which === 116) {
location.reload();
}
});
</script>
</body>
</html>

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,26 +43,65 @@ ipcMain
if(url === ''){
libs.checkNext('youtube-dl');
}else{
libs.download(url,"ffmpeg",function(data,file){
fs.createReadStream(file)
.pipe(unzip.Parse())
.on('entry', function (entry) {
var fileName = entry.path;
var type = entry.type; // 'Directory' or 'File'
var size = entry.size;
console.log(fileName)
if (fileName === "ffmpeg-latest-win32-static/bin/ffmpeg.exe" || fileName === "ffmpeg-latest-win32-static/bin/ffprobe.exe" || fileName === "ffmpeg-latest-win32-static/bin/ffplay.exe") {
entry.pipe(fs.createWriteStream(global.dir+'/lib/'+fileName.split('/')[2]));
console.log('TEST')
z++;
if(z == 3){
libs.checkNext('youtube-dl');
switch(process.platform){
case "win32":
libs.download(url,"ffmpeg",function(data,file){
fs.createReadStream(file)
.pipe(unzip.Parse())
.on('entry', function (entry) {
var fileName = entry.path;
var type = entry.type; // 'Directory' or 'File'
var size = entry.size;
console.log(fileName)
if (fileName === "ffmpeg-latest-win32-static/bin/ffmpeg.exe" || fileName === "ffmpeg-latest-win32-static/bin/ffprobe.exe" || fileName === "ffmpeg-latest-win32-static/bin/ffplay.exe") {
entry.pipe(fs.createWriteStream(global.dir+'/lib/'+fileName.split('/')[2]));
console.log('TEST')
z++;
if(z == 3){
libs.checkNext('youtube-dl');
}
} else {
entry.autodrain();
}
} else {
entry.autodrain();
}
});
});
});
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 = ''
cb();
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