This commit is contained in:
Theenoro 2017-09-10 20:42:21 +02:00
parent bb905111ec
commit 42e12189a4
22 changed files with 9476 additions and 122 deletions

View File

@ -1,10 +1,9 @@
// ==UserScript== // ==UserScript==
// @name Cyber Downloader ADD // @name Tampermonkey Plugin for Cyb3r Downloader
// @namespace http://tampermonkey.net/ // @version 1.0
// @version 0.1 // @description Tampermonkey Plugin for Cyb3r Downloader
// @description try to take over the world! // @author Theenoro
// @author You // @require http://code.jquery.com/jquery-latest.js
// @require http://code.jquery.com/jquery-latest.js
// @match https://www.youtube.com/watch?v=* // @match https://www.youtube.com/watch?v=*
// @grant none // @grant none
// ==/UserScript== // ==/UserScript==

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 98 KiB

View File

@ -1,8 +1,8 @@
{ {
"name": "cyb3r-youtube-downloader", "name": "cyb3r-youtube-downloader",
"productName": "cyb3r-youtube-downloader", "productName": "cyb3r-youtube-downloader",
"version": "1.0.0", "version": "1.5.0",
"description": "My Electron application description", "description": "Cyb3r Downloader",
"main": "src/main.js", "main": "src/main.js",
"scripts": { "scripts": {
"start": "electron-forge start", "start": "electron-forge start",
@ -28,10 +28,19 @@
] ]
}, },
"electronPackagerConfig": { "electronPackagerConfig": {
"packageManager": "npm" "packageManager": "npm",
"win32metadata": {
"ProductName": "Cyb3r Downloader",
"CompanyName": "Thee.moe"
},
"version-string": {
"ProductName": "Cyb3r Downloader",
"CompanyName": "Thee.moe"
}
}, },
"electronWinstallerConfig": { "electronWinstallerConfig": {
"name": "cyb3r_youtube_downloader", "name": "Cyb3r Downloader",
"packageName": "Cyb3r_Downloader",
"icon": "app.ico" "icon": "app.ico"
}, },
"electronInstallerDebian": {}, "electronInstallerDebian": {},
@ -41,8 +50,8 @@
"name": "https://git.tooru.thee.moe/theenoro/electron-simple-youtube-downloader" "name": "https://git.tooru.thee.moe/theenoro/electron-simple-youtube-downloader"
}, },
"windowsStoreConfig": { "windowsStoreConfig": {
"packageName": "", "packageName": "Cyb3r Downloader",
"name": "cyb3ryoutubedownloader" "name": "Cyb3r Downloader"
} }
} }
}, },
@ -51,9 +60,11 @@
"cors": "^2.8.4", "cors": "^2.8.4",
"electron": "^1.6.11", "electron": "^1.6.11",
"electron-compile": "^6.4.1", "electron-compile": "^6.4.1",
"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",
"path": "^0.12.7", "path": "^0.12.7",
"request": "^2.81.0", "request": "^2.81.0",
"unzip": "^0.1.11", "unzip": "^0.1.11",

View File

@ -1,23 +1,41 @@
$(function() { $(function() {
const Config = require('electron-config');
const config = new Config();
var download_progress = $('#download-progress'); var download_progress = $('#download-progress');
var format = null; var format = "mp3";
if(typeof config.get('format') !== 'undefined'){
format = config.get('format');
}
var path = "";
if(typeof config.get('path') !== 'undefined'){
path = config.get('path');
}
var out = $('#output'); var out = $('#output');
var video = document.getElementById('video'); var video = document.getElementById('video');
const ipcRenderer = require('electron').ipcRenderer; const ipcRenderer = require('electron').ipcRenderer;
const request = require('request'); const request = require('request');
const helper = require('./../../helper/string'); const helper = require('./../../helper/string');
const helperx = require('./../../controller/webLoader/router');
var shell = require('electron').shell;
//open links externally by default
$(document).on('click', 'a[href^="http"]', function(event) {
event.preventDefault();
shell.openExternal(this.href);
});
const { const {
dialog dialog
} = require('electron').remote; } = require('electron').remote;
var cache = {}; var cache = {};
var path = "";
var pot = false; var pot = false;
ipcRenderer.send('watchr_event', {}); ipcRenderer.send('watchr_event', {});
ipcRenderer.on('play-in-Window',function(event,arg){ ipcRenderer.on('play-in-Window', function(event, arg) {
pot = arg.do; pot = arg.do;
}) })
ipcRenderer.on('watchr_file', function(event, arg) { ipcRenderer.on('watchr_file', function(event, arg) {
@ -51,25 +69,28 @@ $(function() {
path = dialog.showOpenDialog({ path = dialog.showOpenDialog({
properties: ['openDirectory'] properties: ['openDirectory']
})[0]; })[0];
config.set('path', path);
console.log(path) console.log(path)
ipcRenderer.send('setPath', { ipcRenderer.send('setPath', {
path: path path: path
}); });
}) })
$('#pot').click(function(){ $('#pot').click(function() {
ipcRenderer.send('open-pot', { ipcRenderer.send('open-pot', {});
});
}); });
$('body').delegate('.play-file', 'click', function(e) { $('body').delegate('.play-file', 'click', function(e) {
if(pot === false){ if (pot === false) {
video.setAttribute("src", e.currentTarget.dataset.file); video.setAttribute("src", e.currentTarget.dataset.file);
video.play(); video.play();
}else{ } else {
ipcRenderer.send('pot_run', {file:e.currentTarget.dataset.file}); ipcRenderer.send('pot_run', {
file: e.currentTarget.dataset.file
});
} }
}) })
$('body').delegate('.format', 'click', function(e) { $('body').delegate('.format', 'click', function(e) {
format = e.currentTarget.dataset.format; format = e.currentTarget.dataset.format;
config.set('format', format);
ipcRenderer.send('set-format', { ipcRenderer.send('set-format', {
format: e.currentTarget.dataset.format format: e.currentTarget.dataset.format
}); });
@ -80,7 +101,18 @@ $(function() {
if (url.match('crunchyroll')) { if (url.match('crunchyroll')) {
var video_id = Math.floor(Date.now() / 1000); var video_id = Math.floor(Date.now() / 1000);
$('<div class="media" ><div class="media-left"><a href="#"><img id="img-' + video_id + '" width="128" class="media-object" src="' + '" alt="..."></a></div><div class="media-body" id="body-' + video_id + '"><h4 class="media-heading">' + url + '</h4> Author: ' + '<div class="progress"><div class="progress-bar" id="download-progress-' + video_id + '" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">0%</div></div><div class="media-out-' + video_id + '"></div></div></div>').prependTo('#output'); $(`
<div class="media">
<img id="img-` + video_id + `" class="d-flex align-self-start mr-3" src="..." alt="Generic placeholder image">
<div class="media-body" id="body-` + video_id + `">
<h5 class="mt-0">` + url + `</h5>
Author: ` + `
<div class="progress">
<div class="progress-bar"id="download-progress-` + video_id + `" role="progressbar" style="width: 0%; height: 20px;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="media-out-` + video_id + `"></div>
</div>
</div>`).prependTo('#output');
ipcRenderer.send('start-download', { ipcRenderer.send('start-download', {
url: $('#url').val(), url: $('#url').val(),
id: video_id id: video_id
@ -102,7 +134,18 @@ $(function() {
request request
.get('https://www.youtube.com/oembed?url=https://www.youtube.com/playlist?list=' + playlist_id + '&format=json', function(err, httpResponse, body) { .get('https://www.youtube.com/oembed?url=https://www.youtube.com/playlist?list=' + playlist_id + '&format=json', function(err, httpResponse, body) {
var YT = JSON.parse(body); var YT = JSON.parse(body);
$('<div class="media" ><div class="media-left"><a href="#"><img id="img-' + video_id + '" width="128" class="media-object" src="' + YT.thumbnail_url + '" alt="..."></a></div><div class="media-body" id="body-' + video_id + '"><h4 class="media-heading">' + YT.title + '</h4> Playlistauthor: ' + YT.author_name + '<div class="progress"><div class="progress-bar" id="download-progress-' + video_id + '" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">0%</div></div><div class="media-out-' + video_id + '"></div></div></div>').prependTo('#output'); $(
`<div class="media">
<img id="img-` + video_id + `" class="d-flex align-self-start mr-3" src="`+ YT.thumbnail_url +`" alt="Generic placeholder image">
<div class="media-body" id="body-` + video_id + `">
<h5 class="mt-0">` + YT.title + `</h5>
Author: ` + YT.author_name + `
<div class="progress">
<div class="progress-bar"id="download-progress-` + video_id + `" role="progressbar" style="width: 0%; height: 20px;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="media-out-` + video_id + `"></div>
</div>
</div>`).prependTo('#output');
cache[video_id] = YT.title; cache[video_id] = YT.title;
ipcRenderer.send('start-download-pl', { ipcRenderer.send('start-download-pl', {
url: $('#url').val(), url: $('#url').val(),
@ -114,7 +157,27 @@ $(function() {
request request
.get('https://www.youtube.com/oembed?url=http://www.youtube.com/watch?v=' + video_id + '&format=json', function(err, httpResponse, body) { .get('https://www.youtube.com/oembed?url=http://www.youtube.com/watch?v=' + video_id + '&format=json', function(err, httpResponse, body) {
var YT = JSON.parse(body); var YT = JSON.parse(body);
$('<div class="media" ><div class="media-left"><a href="#"><img id="img-' + video_id + '" width="128" class="media-object" src="' + YT.thumbnail_url + '" alt="..."></a></div><div class="media-body" id="body-' + video_id + '"><h4 class="media-heading">' + YT.title + '</h4> Author: ' + YT.author_name + '<div class="progress"><div class="progress-bar" id="download-progress-' + video_id + '" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">0%</div></div><div class="media-out-' + video_id + '"></div></div></div>').prependTo('#output'); $(
`<div class="media">
<div class="d-flex alogn-self-start mr-3" style="
background:url(`+YT.thumbnail_url+`);
width: 189px;
height: 104px;
background-size: 189px;
background-position: 0px -18px;
"></div>
<div class="media-body" id="body-` + video_id + `">
<h5 class="mt-0">` + YT.title + `</h5>
Author: ` + YT.author_name + `
<div class="progress">
<div class="progress-bar"id="download-progress-` + video_id + `" role="progressbar" style="width: 0%; height: 20px;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div>
<div class="media-out-` + video_id + `"></div>
</div>
</div>`
).prependTo('#output');
cache[video_id] = YT.title; cache[video_id] = YT.title;
ipcRenderer.send('start-download', { ipcRenderer.send('start-download', {
url: $('#url').val(), url: $('#url').val(),
@ -127,4 +190,11 @@ $(function() {
} }
}) })
$('#close').click(function() {
console.log('TEST')
ipcRenderer.send('winHide', {
});
})
}) })

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

5
src/app/libs/popper.min.js vendored Normal file

File diff suppressed because one or more lines are too long

9150
src/app/style/bootstrap.css vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
cursor: pointer; cursor: pointer;
height: 10px; height: 10px;
margin-bottom: 10px; margin-bottom: 10px;
outline: thin solid #FFF; outline: thin solid #1D1D1D;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
width: 100%; width: 100%;
@ -17,7 +17,7 @@
cursor: pointer; cursor: pointer;
height: 10px; height: 10px;
margin-bottom: 10px; margin-bottom: 10px;
outline: thin solid #FFF; outline: thin solid #1D1D1D;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
width: 200px; width: 200px;
@ -29,7 +29,7 @@
} }
#time span, #volume span { #time span, #volume span {
background-color: #FFF; background-color: #1D1D1D;
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;

View File

@ -1 +1 @@
body{margin:0;margin-top:50px;background:#111;color:#f8f8f8}.btn-success{color:#f8f8f8;background-color:#111;border-color:#f8f8f8;transition:all .3s}.btn-success.active,.btn-success:active,.btn-success:focus,.btn-success:hover,.dropdown-toggle:active,.dropdown-toggle:focus,.open>.dropdown-toggle.btn-success{color:#111!important;background-color:#f8f8f8!important;border-color:#f8f8f8!important;transition:all .3s}.dropdown-menu>li>a:focus,.dropdown-menu>li>a:hover{text-decoration:none;color:#f8f8f8;background-color:#111}.dropdown-menu{background-color:#111}span.input-group-btn.open>ul>li>a{background-image:none}.progress{background-image:none;background-color:#111;box-shadow:inset 0 0 3px 0 #f8f8f8}.progress-bar{background-image:none;background-color:#111;box-shadow:inset 0 0 12px 0 #f8f8f8;transition:.3s all}.media:first-child{margin-top:15px}.media{box-shadow:0 0 6px 1px #f8f8f8}.sidebar-nav{padding:10px}.nav.nav-list a{padding:5px 10px}.nav-header{font-weight:700}.scroll{overflow-y:scroll;height:calc(100vh - 96px)}.left-playlist{box-shadow:0 0 6px 1px #f8f8f8;height:calc(100vh - 20vw - 30px)}.row-flex{word-break:break-all;width:100%;display:flex}.row-flex .flex-btn{width:50px}.row-flex .cont{width:100%} body{margin:0;margin-top:70px}.navbar{background:#111!important;color:#f8f8f8}.btn-success{color:#111;background-color:#f8f8f8;border-color:#111;transition:all .3s}.btn-success.active,.btn-success:active,.btn-success:focus,.btn-success:hover,.dropdown-toggle:active,.dropdown-toggle:focus,.open>.dropdown-toggle.btn-success{color:#f8f8f8!important;background-color:#111!important;border-color:#111!important;transition:all .3s}.dropdown-menu>li>a:focus,.dropdown-menu>li>a:hover{text-decoration:none;color:#111;background-color:#f8f8f8}.dropdown-menu{background-color:#f8f8f8}span.input-group-btn.open>ul>li>a{background-image:none}.media:first-child{margin-top:15px}.media{box-shadow:0 0 12px 1px rgba(105,105,105,.28);margin-top:14px}.sidebar-nav{padding:10px}.nav.nav-list a{padding:5px 10px}.nav-header{font-weight:700}.scroll{overflow-y:scroll;height:calc(100vh - 96px)}.left-playlist{box-shadow:0 0 6px 1px #111;height:calc(100vh - 20vw - 30px)}.row-flex{word-break:break-all;width:100%;display:flex}.row-flex .flex-btn{width:50px}.row-flex .cont{width:100%}*{border-radius:0!important}

View File

@ -5,15 +5,19 @@
*/ */
@main-front-color : #f8f8f8; @main-front-color : #111111;
@background-color : #111111; @background-color : #F8F8F8;
@background-2ndcolor: #232323; @background-2ndcolor: #F8F8F8;
body { body {
margin: 0; margin: 0;
margin-top: 50px; margin-top: 70px;
background: @background-color; /*background: @background-color;
color:@main-front-color; color:@main-front-color;*/
}
.navbar{
background: @main-front-color !important;
color:@background-color;
} }
.btn-success { .btn-success {
color: @main-front-color; color: @main-front-color;
@ -38,6 +42,7 @@ body {
span.input-group-btn.open > ul > li> a{ span.input-group-btn.open > ul > li> a{
background-image:none; background-image:none;
} }
/*
.progress{ .progress{
background-image:none; background-image:none;
background-color: @background-color; background-color: @background-color;
@ -48,12 +53,13 @@ span.input-group-btn.open > ul > li> a{
background-color: @background-color; background-color: @background-color;
box-shadow: inset 0px 0px 12px 0px @main-front-color; box-shadow: inset 0px 0px 12px 0px @main-front-color;
transition: .3s all; transition: .3s all;
} }*/
.media:first-child { .media:first-child {
margin-top: 15px; margin-top: 15px;
} }
.media { .media {
box-shadow: 0px 0px 6px 1px @main-front-color; box-shadow: 0 0 12px 1px rgba(105, 105, 105, 0.28);
margin-top: 14px;
} }
.sidebar-nav { .sidebar-nav {
padding: 10px; padding: 10px;
@ -86,3 +92,6 @@ span.input-group-btn.open > ul > li> a{
width:100%; width:100%;
} }
} }
*{
border-radius: 0px !important;
}

View File

@ -8,28 +8,38 @@
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/popper.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/font-awesome/css/font-awesome.min.css" /> <link rel="stylesheet" href="./../libs/font-awesome/css/font-awesome.min.css" />
<link rel="stylesheet" href="./../style/progress.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">
<nav class="navbar fixed-top navbar-dark bg-dark justify-content-between" style="-webkit-app-region: drag">
<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="row">
<div class="col-md-2"> <div class="col-md-2">
<div class="sidebar-nav"> <div class="list-group" role="tablist">
<ul class="nav nav-tabs nav-pills nav-stacked" 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="active"><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"><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>
</ul>
</div> </div>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
@ -38,24 +48,27 @@
<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 input-group-lg"> <div class="input-group">
<span class="input-group-btn"> <span class="input-group-btn">
<button id="party" class="very-sweet-looking btn btn-success btn-sm">Select Folder</button> <button id="party" class="btn btn-secondary" type="button">Select Folder</button>
</span> </span>
<input type="text" class="form-control input-sm" maxlength="128" id="url" placeholder="YT-Url" /> <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">
<button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <div class="dropdown show">
Format <span class="caret"></span> <a class="btn btn-secondary dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
</button> Format
<ul class="dropdown-menu" id="format"> </a>
<li><a href="#" class="format" data-format="mp3">MP3</a></li>
<li role="separator" class="divider"></li> <div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
<li><a href="#" class="format" data-format="mp4">MP4</a></li> <a class="dropdown-item format" href="#" data-format="mp3">MP3</a>
</ul> <div class="dropdown-divider"></div>
</span> <a class="dropdown-item format" href="#" data-format="mp4">MP4</a>
</div>
</div>
</span>
<span class="input-group-btn"> <span class="input-group-btn">
<button type="button" id="start-download" class="btn btn-success btn-sm">Download</button> <button class="btn btn-secondary" type="button" id="start-download">Download</button>
</span> </span>
</div> </div>
</div> </div>
</div> </div>
@ -74,6 +87,14 @@
</div> </div>
</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>

19
src/controller/tray.js Normal file
View File

@ -0,0 +1,19 @@
const {app, Menu, Tray} = require('electron')
const main_window = require('./windows.js/main.js')
module.exports = ()=>{
let tray = new Tray(global.dir+'/app.ico')
const contextMenu = Menu.buildFromTemplate([
{label: 'Open', click(){ main_window.open(); }},
/*{label: 'About',click() { console.log('item 1 clicked') }},
{label: 'Item1', type: 'radio'},
{type: 'separator'},
{label: 'Item2', type: 'radio'},
{label: 'Item3', type: 'radio', checked: true},*/
{label: 'Beenden', click() { main_window.close(); }},
])
tray.setToolTip('Cyb3r Downloader.')
tray.setContextMenu(contextMenu)
return tray;
}

View File

@ -13,6 +13,8 @@ app.post('/download', function(req, res) {
var log = req.query.url; var log = req.query.url;
console.log(log) console.log(log)
// ... // ...
$('#url').val(log);
$('#start-download').click();
}); });

View File

@ -0,0 +1,39 @@
const {
app,
BrowserWindow,
Menu,
dialog,
ipcMain
} = require('electron');
var win = {};
win.win = null;
ipcMain
.on('winHide', (event, arg)=>{
win.win.hide();
})
win.createWindow = ()=>{
win.win = new BrowserWindow({
width: 1010,
height: 800,
minWidth: 1010,
minHeight: 565,
show: true,
frame: false,
icon: global.dir + '/app.ico'
})
win.win.loadURL(`file://${global.dir}/app/view/layout.html`);
win.win.show();
win.win.on('closed', () => {
//win.win = null;
});
}
win.open = ()=>{
win.win.show()
}
win.close = ()=>{
win.win.close();
}
module.exports = win;

View File

@ -1,8 +1,9 @@
const { spawn } = require('child_process'); const { spawn } = require('child_process');
const ipcMain = require('electron').ipcMain; const {Notification,ipcMain}= require('electron');
const dl_routine = require('./youtube-dl.routine') const dl_routine = require('./youtube-dl.routine')
const nodeID3 = require('node-id3');
const web = require('./webLoader/router'); //const web = require('./webLoader/router');
const pot = require('./player_onTop'); const pot = require('./player_onTop');
const folderWatchr = require('./watchr') const folderWatchr = require('./watchr')
@ -14,6 +15,8 @@ var format = "mp3";
var fol = null; var fol = null;
var pot_open_ev = null; var pot_open_ev = null;
var request = require('request').defaults({ encoding: null });
ipcMain ipcMain
.on('start-download', (event, arg)=>{ .on('start-download', (event, arg)=>{
path = orig_path path = orig_path
@ -69,6 +72,11 @@ var yt_dl = class{
var m = dl_routine(path,this.url,format); var m = dl_routine(path,this.url,format);
ls = spawn(m[0],m[1]); ls = spawn(m[0],m[1]);
if(path == ''){ 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{ }else{
@ -121,6 +129,36 @@ var yt_dl = class{
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('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}); me.lwrite.sender.send('process-fin',{percent :me.percent,id:me.id});
if(this.url.match('youtube')){
var url = this.url;
var video_id = this.url.split('v=')[1];
var ampersandPosition = video_id.indexOf('&');
if (ampersandPosition != -1) {
video_id = video_id.substring(0, ampersandPosition);
}
var x = new Notification({
title:"Cyb3r Downloader",
body :"finished download for "+url,
//icon : body
})
x.show()
//request.get('https://i.ytimg.com/vi/'+video_id+'/hqdefault.jpg', function (err, res, body) {
//log[log.length-2].split('[ffmpeg] Destination: ')[1]
/*var tags = {
image: body
}
var success = nodeID3.write(tags, log[log.length-2].split('[ffmpeg] Destination: ')[1]);
console.log(success);*/
//});
}
}); });
} }
} }

View File

@ -11,14 +11,16 @@ const fs = require('fs');
const yt_dl = require('./controller/youtube-dl') const yt_dl = require('./controller/youtube-dl')
const dl = require('./controller/download'); const dl = require('./controller/download');
const browser = require('./controller/windows.js/browser'); const browser = require('./controller/windows.js/browser');
const tray = require('./controller/tray')
const main_window = require('./controller/windows.js/main.js')
let tray_win = null;
if (!fs.existsSync(global.dir+'/tmp/inst')) { if (!fs.existsSync(global.dir+'/tmp/inst')) {
fs.writeFileSync(global.dir+'/tmp/inst',"out"); fs.writeFileSync(global.dir+'/tmp/inst',"out");
var win; var win;
const createWindow = () =>{ const createWindow = () =>{
win = new BrowserWindow({ win = new BrowserWindow({
width: 320, width: 320,
height: 500, height: 500,
@ -41,23 +43,8 @@ if (!fs.existsSync(global.dir+'/tmp/inst')) {
}); });
}else{ }else{
var win ; var win ;
app.getPath('documents') app.getPath('documents')
const createWindow = () =>{ const createWindow = () =>{
//dl.download(dl.ff(process.platform));
/*
win = new BrowserWindow({
width: 1010,
height: 800,
minWidth: 1010,
minHeight: 565,
show: false,
frame: true
})
*/
win = new BrowserWindow({ win = new BrowserWindow({
width: 320, width: 320,
height: 500, height: 500,
@ -68,19 +55,12 @@ if (!fs.existsSync(global.dir+'/tmp/inst')) {
ipcMain ipcMain
.on('start-full', (event, arg)=>{ .on('start-full', (event, arg)=>{
var win2 = new BrowserWindow({
width: 1010, main_window.createWindow();
height: 800, main_window.open();
minWidth: 1010, tray_win = tray();
minHeight: 565, win.close();
show: true,
frame: true,
icon: __dirname + '/app.ico'
})
win.close();
//var z = new browser('http://www.crunchyroll.com/');
win2.loadURL(`file://${__dirname}/app/view/layout.html`)
win = win2;
}); });
win.loadURL(`file://${__dirname}/app/view/init.html`) win.loadURL(`file://${__dirname}/app/view/init.html`)
win.once('ready-to-show', () => { win.once('ready-to-show', () => {
@ -88,7 +68,6 @@ if (!fs.existsSync(global.dir+'/tmp/inst')) {
//var x = new yt_dl("https://www.youtube.com/watch?v=UbQgXeY_zi4") //var x = new yt_dl("https://www.youtube.com/watch?v=UbQgXeY_zi4")
//x.download(); //x.download();
}) })
win.on('closed', () => { win.on('closed', () => {
// Dereference the window object, usually you would store windows // Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time // in an array if your app supports multi windows, this is the time

View File

@ -15,17 +15,18 @@ var handleStartupEvent = function() {
if (process.platform !== 'win32') { if (process.platform !== 'win32') {
return false; return false;
} }
const exeName = path.basename(process.execPath);
var squirrelCommand = process.argv[1]; var squirrelCommand = process.argv[1];
console.log(squirrelCommand); console.log(squirrelCommand);
switch (squirrelCommand) { switch (squirrelCommand) {
case '--squirrel-updated':
case '--squirrel-install': case '--squirrel-install':
target = path.basename(process.execPath); target = path.basename(process.execPath);
updateDotExe = path.resolve(path.dirname(process.execPath), '..', 'update.exe'); updateDotExe = path.resolve(path.dirname(process.execPath), '..', 'update.exe');
var createShortcut = updateDotExe + ' --createShortcut=' + target + ' --shortcut-locations=Desktop,StartMenu' ; var createShortcut = updateDotExe + ' --createShortcut=' + target + ' --shortcut-locations=Desktop,StartMenu' ;
console.log (createShortcut); console.log (createShortcut);
exec(createShortcut); exec(createShortcut);
// Always quit when done spawnUpdate(['--createShortcut', exeName]);
app.quit(); app.quit();
return true; return true;
@ -37,6 +38,7 @@ var handleStartupEvent = function() {
var createShortcut = updateDotExe + ' --removeShortcut=' + target ; var createShortcut = updateDotExe + ' --removeShortcut=' + target ;
console.log (createShortcut); console.log (createShortcut);
exec(createShortcut); exec(createShortcut);
spawnUpdate(['--removeShortcut', exeName]);
// Always quit when done // Always quit when done
app.quit(); app.quit();
return true; return true;

View File

@ -5,15 +5,19 @@
*/ */
@main-front-color : #f8f8f8; @main-front-color : #111111;
@background-color : #111111; @background-color : #F8F8F8;
@background-2ndcolor: #232323; @background-2ndcolor: #F8F8F8;
body { body {
margin: 0; margin: 0;
margin-top: 50px; margin-top: 70px;
background: @background-color; /*background: @background-color;
color:@main-front-color; color:@main-front-color;*/
}
.navbar{
background: @main-front-color !important;
color:@background-color;
} }
.btn-success { .btn-success {
color: @main-front-color; color: @main-front-color;
@ -38,6 +42,7 @@ body {
span.input-group-btn.open > ul > li> a{ span.input-group-btn.open > ul > li> a{
background-image:none; background-image:none;
} }
/*
.progress{ .progress{
background-image:none; background-image:none;
background-color: @background-color; background-color: @background-color;
@ -48,12 +53,13 @@ span.input-group-btn.open > ul > li> a{
background-color: @background-color; background-color: @background-color;
box-shadow: inset 0px 0px 12px 0px @main-front-color; box-shadow: inset 0px 0px 12px 0px @main-front-color;
transition: .3s all; transition: .3s all;
} }*/
.media:first-child { .media:first-child {
margin-top: 15px; margin-top: 15px;
} }
.media { .media {
box-shadow: 0px 0px 6px 1px @main-front-color; box-shadow: 0 0 12px 1px rgba(105, 105, 105, 0.28);
margin-top: 14px;
} }
.sidebar-nav { .sidebar-nav {
padding: 10px; padding: 10px;
@ -86,3 +92,6 @@ span.input-group-btn.open > ul > li> a{
width:100%; width:100%;
} }
} }
*{
border-radius: 0px !important;
}

View File

@ -1,15 +0,0 @@
# Netscape HTTP Cookie File
# http://curl.haxx.se/rfc/cookie_spec.html
# This is a generated file! Do not edit.
.crunchyroll.com TRUE / FALSE 1534887951 __cfduid db1426254a0b86e7ca8b70551a18644361503351951
.crunchyroll.com TRUE / FALSE 1537220753 __qca P0-1835482882-1503351953593
.crunchyroll.com TRUE / FALSE 1566942248 _ga GA1.2.1843711990.1503351953
.crunchyroll.com TRUE / FALSE 1503956648 _gid GA1.2.1726060626.1503868189
.crunchyroll.com TRUE / FALSE 1504561873 c_d p%3D1
.crunchyroll.com TRUE / FALSE 1504561873 c_userid 64927993
.crunchyroll.com TRUE / FALSE 1504561873 c_userkey 2%3AZxOX%2BsILKGFm2Nmfc6%2FX12lxWjo%3D
.crunchyroll.com TRUE / FALSE 1518903952 c_visitor 95852853-d74d-4e9c-b5ad-182b74e6f44f
.crunchyroll.com TRUE / FALSE 1503960371 cf_clearance fb4b8c534496cdfec5683c51ec28dc2e4c70e5ce-1503351970-604800
.crunchyroll.com TRUE / FALSE 1537220753 sess_id jjdcwcg0amrsbt44eviz34disrmrqd2m
.crunchyroll.com TRUE / FALSE 1537220753 session_id 2074779edf6db7782876092c0d2f03db

View File

@ -1 +0,0 @@
out