From e8658c96b1e733a1b65390d5a96cfa3600ec6b16 Mon Sep 17 00:00:00 2001 From: Kylart Date: Fri, 3 Mar 2017 06:12:27 +0100 Subject: [PATCH] Cleaned up renderer.js from downloader things. --- src/renderer.js | 39 +++++++-------------------------------- 1 file changed, 7 insertions(+), 32 deletions(-) diff --git a/src/renderer.js b/src/renderer.js index 726002f..d9d1700 100644 --- a/src/renderer.js +++ b/src/renderer.js @@ -1,18 +1,17 @@ +/** + * + * This file is the main one in the rendering process. Here we navigate + * between the vue objects and set up most important functions. + * + */ + /* ------------------ IMPORTS ------------------ */ const remote = require('electron').remote const main = remote.require('./main.js') -const shell = require('electron').shell const fs = require('fs') const os = require('os') - -// Those are needed to download the torrents const path = require('path') -const request = require('request') -const findRemoveSync = require('find-remove') -const parseTorrent = require('parse-torrent') - -const player = require('play-sound')(opts = {}) // Mal API const mal = require('malapi').Anime @@ -23,9 +22,6 @@ const malScraper = require('mal-scraper') /* ----------------- END IMPORTS ----------------- */ -const DIR = path.join(os.userInfo().homedir, '.KawAnime') -const magnetPath = path.join(DIR, 'magnets.txt') - /* ----------------- VUE IMPORTS ----------------- */ require(path.join(__dirname, 'downloader', 'index.js')) @@ -154,27 +150,6 @@ function getLatest() { }) } -function downloadFile(file_url, name) { - let req = request({ - method: 'GET', - uri: file_url - }) - - let out = fs.createWriteStream(path.join(DIR, `${name}.torrent`)) - req.pipe(out) -} - -function startTorrent(file_url, name) { - // Removing old torrents - findRemoveSync(DIR, {extensions: ['.torrent']}) - - // Downloading the new ones - downloadFile(file_url, name) - - // Opening them - main.openTorrents() -} - function makeResearchOnMal(name) { mal.fromName(name).then((anime) => {