diff --git a/src/app/style/style.css b/src/app/style/style.css new file mode 100644 index 0000000..571a90d --- /dev/null +++ b/src/app/style/style.css @@ -0,0 +1,4 @@ +body { + margin: 0; + background: #333; +} \ No newline at end of file diff --git a/src/app/view/layout.html b/src/app/view/layout.html index d956a49..757c4b0 100644 --- a/src/app/view/layout.html +++ b/src/app/view/layout.html @@ -16,6 +16,7 @@ + diff --git a/src/controller/download.js b/src/controller/download.js index bc0d7bf..10267e5 100644 --- a/src/controller/download.js +++ b/src/controller/download.js @@ -37,26 +37,31 @@ ipcMain libs.libs = libsx; if(libsx['ffmpeg'] === null || libsx['ffplay'] === null || libsx['ffprobe'] === null ){ var z = 0; - libs.download(libs.ff(process.platform),"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'); + var url = libs.ff(process.platform); + 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'); + } + } else { + entry.autodrain(); } - } else { - entry.autodrain(); - } - }); - }); + }); + }); + } }else{ libs.checkNext('youtube-dl'); } @@ -80,6 +85,9 @@ libs.ff = (os)=>{ case "win32": url = 'http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-latest-win32-static.zip'; break; + case "linux": + url = '' + default: } @@ -89,15 +97,19 @@ libs.yt_dl = (os,cb)=>{ var url = ""; switch (os) { case "win32": - url = 'https://yt-dl.org/downloads/2017.08.13/youtube-dl.exe' + url = 'https://yt-dl.org/downloads/2017.08.13/youtube-dl.exe'; + libs.download(url,"youtube-dl",function(data,file){ + fs.renameSync(file,global.dir+'/lib/youtube-dl.exe'); + cb(); + }) break; + case "linux": + url = '' + cb(); default: - + } - libs.download(url,"youtube-dl",function(data,file){ - fs.renameSync(file,global.dir+'/lib/youtube-dl.exe'); - cb(); - }) + } libs.download = (url,data,cb)=>{ diff --git a/src/controller/install/linux/script.js b/src/controller/install/linux/script.js new file mode 100644 index 0000000..41b1810 --- /dev/null +++ b/src/controller/install/linux/script.js @@ -0,0 +1,53 @@ +const { exec } = require('child_process'); + +var install = {}; + + + + + +install.init = (cb)=>{ + var url = [ + ['ffmpeg','https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-64bit-static.tar.xz'], + ['youtube-dl' ,'https://yt-dl.org/downloads/latest/youtube-dl'] + ] + var download = (i)=>{ + install.download(url[i],function(path){ + switch (i) { + case 0: + shell. + break; + default: + + } + + + if(i{ + var r = request(url); + var actual = 1; + var full = 100; + var perc = 0; + r.on('data', function (chunk) { + actual += chunk.length; + perc = actual / full * 100; + console.log(perc); + libs.listen.sender.send('progress',{percent :Math.floor(perc)}); + }); + r.on('response', function (res) { + var path = global.dir+'/tmp/'+url.split('/')[url.split('/').length-1]; + res.pipe(fs.createWriteStream( path )); + full = res.headers[ 'content-length' ] ; + res.on('end', function () { + cb(path); + }) + }); +} diff --git a/src/main.js b/src/main.js index 4b8fddb..1dc289b 100644 --- a/src/main.js +++ b/src/main.js @@ -1,6 +1,17 @@ var app = require('./index'); var handleStartupEvent = function() { + console.log(process.platform); + switch (process.platform) { + case 'win32': + + break; + case 'linux': + + break; + default: + + } if (process.platform !== 'win32') { return false; }