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": { "dependencies": {
"body-parser": "^1.17.2", "body-parser": "^1.17.2",
"cors": "^2.8.4", "cors": "^2.8.4",
"electron": "^1.7.6", "electron": "^1.7.6",
"electron-config": "^1.0.0", "electron-config": "^1.0.0",
"express": "^4.15.4", "express": "^4.15.4",
"fs": "0.0.1-security", "fs": "0.0.1-security",
"mkdirp": "^0.5.1", "mkdirp": "^0.5.1",
"node-id3": "0.0.10", "node-id3": "0.0.10",
"path": "^0.12.7", "path": "^0.12.7",
"request": "^2.81.0", "request": "^2.81.0",
"unzip": "^0.1.11", "unzip": "^0.1.11",
"watchr": "^3.0.1" "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> <html>
<head> <head>
<script> <script>
if (typeof module === 'object') { if (typeof module === 'object') {
window.module = module; window.module = module;
module = undefined; module = undefined;
} }
</script> </script>
<!--<script src="./../libs/jquery/jquery-3.2.1.min.js"></script> <!--<script src="./../libs/jquery/jquery-3.2.1.min.js"></script>
<script src="./../libs/bootstrap/js/bootstrap.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/popper.min.js"></script>
<script src="./../libs/bootstrap/bootstrap.min.js"></script> <script src="./../libs/bootstrap/bootstrap.min.js"></script>
<script src="./../js/player.js"></script> <script src="./../js/player.js"></script>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Cyb3r Downloader</title> <title>Cyb3r Downloader</title>
<!--<link rel="stylesheet" href="./../libs/bootstrap/css/bootstrap.css" /> <!--<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/css/bootstrap-theme.css" />-->
<link rel="stylesheet" href="./../libs/bootstrap/bootstrap.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="./../libs/font-awesome/css/font-awesome.min.css" />
<link rel="stylesheet" href="./../style/bootstrap.min.css" /> <link rel="stylesheet" href="./../style/bootstrap.min.css" />
<link rel="stylesheet" href="./../style/style.css" /> <link rel="stylesheet" href="./../style/style.css" />
<link rel="stylesheet" href="./../style/player.css" /> <link rel="stylesheet" href="./../style/player.css" />
</head> </head>
<body> <body>
<div class="container-fluid"> <div class="container-fluid">
<div class="collapse" id="navigota" style=" position: fixed; top: 56px; left: 0px;z-index: 999999;"> <div class="collapse" id="navigota" style=" position: fixed; top: 56px; left: 0px;z-index: 999999;">
<div class="bg-dark p-4"> <div class="bg-dark p-4">
<div class="list-group" role="tablist" id=""> <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="#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="#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> <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>
</div> <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>
<nav class="navbar fixed-top navbar-dark bg-dark justify-content-between" style="-webkit-app-region: drag"> </div>
<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>
<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> <span class="navbar-toggler-icon"></span>
</button> </button>
<a class="navbar-brand">Cyb3r Downloader</a> <a class="navbar-brand">Cyb3r Downloader</a>
<form class="form-inline"> <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> <button class="btn btn-outline-success my-2 my-sm-0" id="close" style="-webkit-app-region: no-drag;">X</button>
</form> </form>
</nav> </nav>
<div class="row"> <div class="row">
<div class="col-md-2" style="display:none"> <div class="col-md-2" style="display:none">
<div class="list-group" role="tablist" > <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="#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="#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> <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>
</div> <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>
<div style="max-width:380px;margin:auto;margin-bottom:25px;"> <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; padding: 0;
height: 35px; height: 35px;
display: flex; display: flex;
@ -69,28 +72,28 @@
box-shadow: 0px -1px 8px 4px rgba(69, 69, 69, 0.18); box-shadow: 0px -1px 8px 4px rgba(69, 69, 69, 0.18);
z-index:99999999; 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> <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"> <div id="time">
<span></span> <span></span>
</div> </div>
<button class="btn nabbar-btn btn-link" style="margin:0;"><i class="fa fa-volume-up" aria-hidden="true"></i></button> <button class="btn nabbar-btn btn-link" style="margin:0;"><i class="fa fa-volume-up" aria-hidden="true"></i></button>
<div id="volume"> <div id="volume">
<span></span> <span></span>
</div> </div>
<button class="btn nabbar-btn btn-link" id="pot" style="margin:0;"><i class="fa fa-window-restore" aria-hidden="true"></i></button> <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> </div>
<div class="tab-content"> <div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="download"> <div role="tabpanel" class="tab-pane active" id="download">
<input id="business" type="file" style="display: none" /> <input id="business" type="file" style="display: none" />
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="input-group"> <div class="input-group">
<span class="input-group-btn"> <span class="input-group-btn">
<button id="party" class="btn btn-secondary" type="button">Select Folder</button> <button id="party" class="btn btn-secondary" type="button">Select Folder</button>
</span> </span>
<input type="text" class="form-control" id="url" placeholder="YT-Url" aria-label="Product name"> <input type="text" class="form-control" id="url" placeholder="YT-Url" aria-label="Product name">
<span class="input-group-btn"> <span class="input-group-btn">
<div class="dropdown show"> <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"> <a class="btn btn-secondary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Format Format
@ -103,59 +106,102 @@
</div> </div>
</div> </div>
</span> </span>
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-secondary" type="button" id="start-download">Download</button> <button class="btn btn-secondary" type="button" id="start-download">Download</button>
</span> </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> </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 class="left-playlist">
</div> </div>
</div>--> </div>-->
</div>
</div> </div>
<script src="./../js/app.js"></script> </div>
<script> <script src="./../js/app.js"></script>
document.addEventListener("keydown", function (e) { <script>
if (e.which === 123) { document.addEventListener("keydown", function(e) {
require('remote').getCurrentWindow().toggleDevTools(); if (e.which === 123) {
} else if (e.which === 116) { require('remote').getCurrentWindow().toggleDevTools();
location.reload(); } else if (e.which === 116) {
} location.reload();
}); }
</script> });
</script>
</body> </body>
</html> </html>

View File

@ -1,7 +1,8 @@
const request = require('request'); const request = require('request');
const fs = require('fs') const fs = require('fs')
const ipcMain = require('electron').ipcMain; const ipcMain = require('electron').ipcMain;
const unzip = require('unzip') const unzip = require('unzip');
const { spawn } = require('child_process');
var libsx = { var libsx = {
@ -27,6 +28,7 @@ ipcMain
break; break;
default: default:
} }
for (var lib in libsx) { for (var lib in libsx) {
if (fs.existsSync(global.dir+"/lib/"+libsx[lib])) { if (fs.existsSync(global.dir+"/lib/"+libsx[lib])) {
@ -41,26 +43,65 @@ ipcMain
if(url === ''){ if(url === ''){
libs.checkNext('youtube-dl'); libs.checkNext('youtube-dl');
}else{ }else{
libs.download(url,"ffmpeg",function(data,file){ switch(process.platform){
fs.createReadStream(file) case "win32":
.pipe(unzip.Parse()) libs.download(url,"ffmpeg",function(data,file){
.on('entry', function (entry) { fs.createReadStream(file)
var fileName = entry.path; .pipe(unzip.Parse())
var type = entry.type; // 'Directory' or 'File' .on('entry', function (entry) {
var size = entry.size; var fileName = entry.path;
console.log(fileName) var type = entry.type; // 'Directory' or 'File'
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") { var size = entry.size;
entry.pipe(fs.createWriteStream(global.dir+'/lib/'+fileName.split('/')[2])); console.log(fileName)
console.log('TEST') 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") {
z++; entry.pipe(fs.createWriteStream(global.dir+'/lib/'+fileName.split('/')[2]));
if(z == 3){ console.log('TEST')
libs.checkNext('youtube-dl'); 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{ }else{
libs.checkNext('youtube-dl'); libs.checkNext('youtube-dl');
@ -86,8 +127,8 @@ libs.ff = (os)=>{
url = 'http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-latest-win32-static.zip'; url = 'http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-latest-win32-static.zip';
break; break;
case "linux": case "linux":
url = '' url = 'https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-64bit-static.tar.xz'
default: default:
} }
@ -104,12 +145,15 @@ libs.yt_dl = (os,cb)=>{
}) })
break; break;
case "linux": case "linux":
url = '' url = 'https://yt-dl.org/downloads/latest/youtube-dl'
cb(); libs.download(url,"youtube-dl",function(data,file){
fs.renameSync(file,global.dir+'/lib/youtube-dl');
cb();
})
default: default:
} }
} }
libs.download = (url,data,cb)=>{ libs.download = (url,data,cb)=>{
@ -133,6 +177,8 @@ libs.download = (url,data,cb)=>{
}); });
} }
function win_ffmpeg(){
}
module.exports = libs; module.exports = libs;

View File

@ -1,12 +1,20 @@
const {app, Menu, Tray} = require('electron') const {app, Menu, Tray} = require('electron')
const main_window = require('./windows.js/main.js') const main_window = require('./windows.js/main.js')
const path = require('path')
module.exports = ()=>{ 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([ const contextMenu = Menu.buildFromTemplate([
{label: 'Open', click(){ main_window.open() }}, {label: 'Open', click(){ main_window.open() }},
/*{label: 'About',click() { console.log('item 1 clicked') }}, /*{label: 'About',click() { console.log('item 1 clicked') }},

1
src/tmp/inst Normal file
View File

@ -0,0 +1 @@
out