diff --git a/README.md b/README.md
index e8c7393..8b5d9ac 100644
--- a/README.md
+++ b/README.md
@@ -3,6 +3,9 @@
![./current-preview.PNG](./current-preview.PNG)
+# v 1.4.0 Alpha
+
+Preview [Video](https://cl.thee.moe/index.php/s/T8FEaFFxyhlxIj6)
# Download 1.3.0
diff --git a/package.json b/package.json
index cd7209a..7e95600 100644
--- a/package.json
+++ b/package.json
@@ -49,9 +49,12 @@
"dependencies": {
"electron": "^1.6.11",
"electron-compile": "^6.4.1",
+ "fs": "0.0.1-security",
"mkdirp": "^0.5.1",
+ "path": "^0.12.7",
"request": "^2.81.0",
- "unzip": "^0.1.11"
+ "unzip": "^0.1.11",
+ "watchr": "^3.0.1"
},
"devDependencies": {
"babel-plugin-transform-async-to-generator": "^6.24.1",
diff --git a/src/app/js/app.js b/src/app/js/app.js
index 686f356..0558759 100644
--- a/src/app/js/app.js
+++ b/src/app/js/app.js
@@ -1,68 +1,130 @@
-$(function(){
+$(function() {
var download_progress = $('#download-progress');
+ var format = null;
var out = $('#output');
+ var video = document.getElementById('video');
const ipcRenderer = require('electron').ipcRenderer;
const request = require('request');
- const {dialog} = require('electron').remote;
+ const helper = require('./../../helper/string');
+
+ const {
+ dialog
+ } = require('electron').remote;
var cache = {};
var path = "";
+
+ var pot = false;
+
+ ipcRenderer.send('watchr_event', {});
+ ipcRenderer.on('play-in-Window',function(event,arg){
+ pot = arg.do;
+ })
+ ipcRenderer.on('watchr_file', function(event, arg) {
+ arg.file = encodeURI(arg.file)
+ if (arg.type === "add") {
+ $('#watchr_files').append('
' + arg.file + '
')
+ } else if (arg.type === "remove") {
+ $('.file[data-file="' + arg.file + '"]').remove();
+ }
+ $('#download-progress-' + arg.id).html(arg.percent);
+ })
ipcRenderer.on('download-progress', function(event, arg) {
- console.log(arg); // prints "pong"
- $('#download-progress-'+arg.id).css("width",arg.percent);
- $('#download-progress-'+arg.id).html(arg.percent);
+ console.log(arg); // prints "pong"
+ $('#download-progress-' + arg.id).css("width", arg.percent);
+ $('#download-progress-' + arg.id).html(arg.percent);
});
ipcRenderer.on('process-fin', function(event, arg) {
- console.log(arg); // prints "pong"
- $('#download-progress-'+arg.id).css("width",arg.percent);
- $('#download-progress-'+arg.id).html("CONVERTED");
+ console.log(arg); // prints "pong"
+ $('#download-progress-' + arg.id).css("width", arg.percent);
+ $('#download-progress-' + arg.id).html("CONVERTED");
});
ipcRenderer.on('file', function(event, arg) {
- console.log(arg); // prints "pong"
- $('#body-'+arg.id).append('
');
+ console.log('DOWNLOADED')
+ console.log(arg); // prints "pong"
+
+ $('.media-out-' + arg.id).html('
');
+ //var video = document.getElementById('video');
+ //$('#body-' + arg.id).append('
');
});
document.getElementById('party').addEventListener('click', _ => {
- path = dialog.showOpenDialog({
- properties: ['openDirectory']
- })[0];
- console.log(path)
- ipcRenderer.send('setPath', {path:path});
+ path = dialog.showOpenDialog({
+ properties: ['openDirectory']
+ })[0];
+ console.log(path)
+ ipcRenderer.send('setPath', {
+ path: path
+ });
})
- $('body').delegate('.format','click',function(e){
- ipcRenderer.send('set-format', {format:e.currentTarget.dataset.format});
+ $('#pot').click(function(){
+ ipcRenderer.send('open-pot', {
+ });
+ });
+ $('body').delegate('.play-file', 'click', function(e) {
+ if(pot === false){
+ video.setAttribute("src", e.currentTarget.dataset.file);
+ video.play();
+ }else{
+ ipcRenderer.send('pot_run', {file:e.currentTarget.dataset.file});
+ }
+ })
+ $('body').delegate('.format', 'click', function(e) {
+ format = e.currentTarget.dataset.format;
+ ipcRenderer.send('set-format', {
+ format: e.currentTarget.dataset.format
+ });
console.log(e.currentTarget.dataset.format);
})
- $('#start-download').click(function(){
- var video_id = $('#url').val().split('v=')[1];
- var ampersandPosition = video_id.indexOf('&');
- if(ampersandPosition != -1) {
- video_id = video_id.substring(0, ampersandPosition);
- }
- var playlist_id = $('#url').val().split('list=')[1];
- if(typeof playlist_id !== 'undefined'){
- var playlist_idPOS = playlist_id.indexOf('&');
- if(playlist_idPOS != -1) {
- playlist_id = playlist_id.substring(0, playlist_idPOS);
+ $('#start-download').click(function() {
+ var url = $('#url').val();
+
+ if (url.match('crunchyroll')) {
+ var video_id = Math.floor(Date.now() / 1000);
+ $('
').prependTo('#output');
+ ipcRenderer.send('start-download', {
+ url: $('#url').val(),
+ id: video_id
+ });
+ } else {
+
+ var video_id = $('#url').val().split('v=')[1];
+ var ampersandPosition = video_id.indexOf('&');
+ if (ampersandPosition != -1) {
+ video_id = video_id.substring(0, ampersandPosition);
}
+ var playlist_id = $('#url').val().split('list=')[1];
+ if (typeof playlist_id !== 'undefined') {
+ var playlist_idPOS = playlist_id.indexOf('&');
+ if (playlist_idPOS != -1) {
+ playlist_id = playlist_id.substring(0, playlist_idPOS);
+ }
+
+ request
+ .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);
+ $('
').prependTo('#output');
+ cache[video_id] = YT.title;
+ ipcRenderer.send('start-download-pl', {
+ url: $('#url').val(),
+ id: video_id,
+ folder: YT.author_name + '-' + YT.title.replace(/\|/g, "_")
+ });
+ })
+ } else {
+ request
+ .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);
+ $('
').prependTo('#output');
+ cache[video_id] = YT.title;
+ ipcRenderer.send('start-download', {
+ url: $('#url').val(),
+ id: video_id
+ });
+ })
+ }
+ console.log(playlist_id + ' id:' + video_id)
- request
- .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);
- $( '
').prependTo('#output');
- cache[video_id] = YT.title;
- ipcRenderer.send('start-download-pl', {url:$('#url').val(),id:video_id,folder:YT.author_name+'-'+YT.title});
- })
- }else{
- request
- .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);
- $( '
').prependTo('#output');
- cache[video_id] = YT.title;
- ipcRenderer.send('start-download', {url:$('#url').val(),id:video_id});
- })
}
- console.log(playlist_id+' id:'+video_id)
-
})
})
diff --git a/src/app/js/player.js b/src/app/js/player.js
new file mode 100644
index 0000000..907001a
--- /dev/null
+++ b/src/app/js/player.js
@@ -0,0 +1,46 @@
+var video;
+$(function(){
+ video = document.getElementById('video');
+
+
+ // btn
+ var st_play = '
';
+ var st_pause = '
';
+
+ video.ontimeupdate = function(){
+ var percentage = ( video.currentTime / video.duration ) * 100;
+ $("#time span").css("width", percentage+"%");
+ };
+
+ $("#time").on("click", function(e){
+ var offset = $(this).offset();
+ var left = (e.pageX - offset.left);
+ var totalWidth = $("#time").width();
+ var percentage = ( left / totalWidth );
+ var vidTime = video.duration * percentage;
+ video.currentTime = vidTime;
+ })
+ $("#volume span").css('width',(100*video.volume)+'%')
+ $("#volume").on("click", function(e){
+ var offset = $(this).offset();
+ var left = (e.pageX - offset.left);
+ var totalWidth = $("#volume").width();
+ var percentage = ( left / totalWidth );
+ var volume = 1 * percentage;
+ video.volume = volume;
+ $("#volume span").css('width',(100*percentage)+'%')
+ console.log(volume)
+ })
+
+
+
+ $('#play').click(function(){
+ if(video.paused){
+ video.play();
+ $('#play').html(st_pause)
+ }else{
+ video.pause();
+ $('#play').html(st_play)
+ }
+ })
+})
diff --git a/src/app/js/pot_main.js b/src/app/js/pot_main.js
new file mode 100644
index 0000000..4a42595
--- /dev/null
+++ b/src/app/js/pot_main.js
@@ -0,0 +1,25 @@
+$(function() {
+ const ipcRenderer = require('electron').ipcRenderer;
+ ipcRenderer.send('pot_real_open', {x:"xx"});
+
+
+ $('#close').click(function () {
+ ipcRenderer.send('close_pot',{});
+ });
+ ipcRenderer.on('pot_play',function(event,arg){
+ var file = arg.file;
+ video.setAttribute("src", file);
+ video.play();
+ })
+ $('.navbar').on( "mouseleave",function () {
+ $('.navbar').css('opacity',"0")
+ });
+ $('.navbar').on( "mouseenter",function () {
+ $('.navbar').css('opacity',"1")
+ });
+ $('body').on( "mouseenter",function () {
+ $('.navbar').css('opacity',"1")
+ });
+
+
+})
diff --git a/src/app/style/player.css b/src/app/style/player.css
new file mode 100644
index 0000000..aeb38d2
--- /dev/null
+++ b/src/app/style/player.css
@@ -0,0 +1,38 @@
+#time {
+ cursor: pointer;
+ height: 10px;
+ margin-bottom: 10px;
+ outline: thin solid #FFF;
+ overflow: hidden;
+ position: relative;
+ width: 100%;
+ vertical-align: -webkit-baseline-middle;
+ line-height: 1.42857143;
+ height: 9px;
+ display: inline-block;
+ top: 13px;
+}
+
+#volume {
+ cursor: pointer;
+ height: 10px;
+ margin-bottom: 10px;
+ outline: thin solid #FFF;
+ overflow: hidden;
+ position: relative;
+ width: 200px;
+ vertical-align: -webkit-baseline-middle;
+ line-height: 1.42857143;
+ height: 9px;
+ display: inline-block;
+ top: 13px;
+}
+
+#time span, #volume span {
+ background-color: #FFF;
+ position: absolute;
+ top: 0;
+ left: 0;
+ height: 10px;
+ width: 0px;
+}
diff --git a/src/app/style/style.css b/src/app/style/style.css
index 0e14107..4be1566 100644
--- a/src/app/style/style.css
+++ b/src/app/style/style.css
@@ -1,59 +1 @@
-body {
- margin: 0;
- background: #131313;
- color:#e9188d;
-}
-.btn-success {
- color: #e9188d;
- background-color: #131313;
- border-color: #e9188d;
- transition: all .3s;
-}
-.btn-success:hover ,.btn-success:active,.btn-success:focus,.dropdown-toggle:focus,.dropdown-toggle:active,.btn-success:active, .btn-success.active, .open > .dropdown-toggle.btn-success {
- color: #131313 !important;
- background-color: #e9188d !important;
- border-color: #e9188d !important;
- transition: all .3s;
-}
-.dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus {
- text-decoration: none;
- color: rgb(233, 24, 141);
- background-color: #131313;
-}
-.dropdown-menu{
- background-color: #131313;
-}
-span.input-group-btn.open > ul > li> a{
- background-image:none;
-}
-.progress{
- background-image:none;
- background-color: #131313;
- box-shadow: inset 0px 0px 3px 0px #da1985;
-}
-.progress-bar{
- background-image:none;
- background-color: #131313;
- box-shadow: inset 0px 0px 12px 0px #da1985;
-}
-.media:first-child {
- margin-top: 15px;
-}
-.media {
- box-shadow: 0px 0px 6px 1px #ff008e;
-}
-.sidebar-nav {
- padding: 10px;
-}
-.nav.nav-list a {
- padding: 5px 10px;
-}
-
-.nav-header {
-
- font-weight: bold;
-}
-.scroll{
- overflow-y: scroll;
- height: calc( 100vh - 46px);
-}
+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%}
\ No newline at end of file
diff --git a/src/app/style/style.less b/src/app/style/style.less
new file mode 100644
index 0000000..1fb83d7
--- /dev/null
+++ b/src/app/style/style.less
@@ -0,0 +1,88 @@
+/*
+
+
+
+
+*/
+
+@main-front-color : #f8f8f8;
+@background-color : #111111;
+@background-2ndcolor: #232323;
+
+body {
+ margin: 0;
+ margin-top: 50px;
+ background: @background-color;
+ color:@main-front-color;
+}
+.btn-success {
+ color: @main-front-color;
+ background-color: @background-color;
+ border-color: @main-front-color;
+ transition: all .3s;
+}
+.btn-success:hover ,.btn-success:active,.btn-success:focus,.dropdown-toggle:focus,.dropdown-toggle:active,.btn-success:active, .btn-success.active, .open > .dropdown-toggle.btn-success {
+ color: @background-color !important;
+ background-color: @main-front-color !important;
+ border-color: @main-front-color !important;
+ transition: all .3s;
+}
+.dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus {
+ text-decoration: none;
+ color: @main-front-color;
+ background-color: @background-color;
+}
+.dropdown-menu{
+ background-color: @background-color;
+}
+span.input-group-btn.open > ul > li> a{
+ background-image:none;
+}
+.progress{
+ background-image:none;
+ background-color: @background-color;
+ box-shadow: inset 0px 0px 3px 0px @main-front-color;
+}
+.progress-bar{
+ background-image:none;
+ background-color: @background-color;
+ box-shadow: inset 0px 0px 12px 0px @main-front-color;
+ transition: .3s all;
+}
+.media:first-child {
+ margin-top: 15px;
+}
+.media {
+ box-shadow: 0px 0px 6px 1px @main-front-color;
+}
+.sidebar-nav {
+ padding: 10px;
+}
+.nav.nav-list a {
+ padding: 5px 10px;
+}
+
+.nav-header {
+
+ font-weight: bold;
+}
+.scroll{
+ overflow-y: scroll;
+ height: ~"calc( 100vh - 96px)";
+}
+
+.left-playlist{
+ box-shadow: 0px 0px 6px 1px @main-front-color;
+ height: ~"calc(100vh - 20vw - 30px )";
+}
+.row-flex{
+ word-break: break-all;
+ width:100%;
+ display: flex;
+ .flex-btn{
+ width: 50px;
+ }
+ .cont{
+ width:100%;
+ }
+}
diff --git a/src/app/view/layout.html b/src/app/view/layout.html
index 4174117..18f5aa9 100644
--- a/src/app/view/layout.html
+++ b/src/app/view/layout.html
@@ -10,7 +10,7 @@
-
+
Cyb3r Downloader
@@ -18,6 +18,7 @@
+
@@ -25,42 +26,74 @@