From 788e63a92e0fa1a045ac26cfb3752d16b091c2bb Mon Sep 17 00:00:00 2001 From: Itamar Oren Date: Sun, 26 Feb 2023 19:23:03 -0500 Subject: [PATCH] Removed useless code --- anime/downloadVideo.js | 2 +- anime/getAndSave.js | 17 +++-------------- utils/JSON.js | 4 ++-- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/anime/downloadVideo.js b/anime/downloadVideo.js index 541e471..20b6f15 100644 --- a/anime/downloadVideo.js +++ b/anime/downloadVideo.js @@ -2,7 +2,7 @@ import { execFileSync } from 'child_process'; import { getJSON } from '../utils/JSON.js'; import chalk from 'chalk'; -export default async function donwloadFromStream(url, newpath) { +export default async function donwloadFromStream(url) { try { const vpath = await getJSON("vpath"); // start "C:\Program Files\VideoLAN\VLC\vlc.exe" url diff --git a/anime/getAndSave.js b/anime/getAndSave.js index fec14b5..5b8a68d 100644 --- a/anime/getAndSave.js +++ b/anime/getAndSave.js @@ -73,15 +73,14 @@ async function getAnime9(id, episode = null) { const epResp = await axios.get(url); const epSource = epResp.data.sources[0]; - const vidPath = await getJSON("apath"); - - const newpath = path.resolve(vidPath, data.title + ' - ' + episodeData.title + '.m3u8'); + // const vidPath = await getJSON("apath"); + // const newpath = path.resolve(vidPath, data.title + ' - ' + episodeData.title + '.m3u8'); console.log(chalk.green('done!')); console.log(chalk.green(`Now playing ${chalk.bold(`${data.title} episode ${epNumber} - ${episodeData.title}`)}`)); //Download the file - downloadStream(epSource.url, newpath); + downloadStream(epSource.url); } catch (err) { console.error(err); return console.log(chalk.red(`ERROR: ${err.message}\n\nTask aborted`)); @@ -141,16 +140,6 @@ async function getAnime(name, subcommand, episode = null) { * @returns */ export default async function animeMain(command) { - const apath = getJSON("apath"); - if (!apath) { - const apath = await askUserQuery("Please specify a path to save to:\n"); - if (!apath || (apath === path.basename(apath))) { - return console.log(chalk.red('Incorrect path!')); - } - - setJSON("apath", apath); - } - const vpath = getJSON("vpath"); if (!vpath) { const vpath = await askUserQuery("Please specify a path to your vlc.exe:\n"); diff --git a/utils/JSON.js b/utils/JSON.js index f8b8a23..9c3651b 100644 --- a/utils/JSON.js +++ b/utils/JSON.js @@ -8,7 +8,7 @@ const __dirname = dirname(__filename); export function getJSON(key) { - const p = path.resolve(__dirname, "../config.json"); + const p = path.resolve(__dirname, "../ionconfig.json"); if (fs.existsSync(p)) { const data = fs.readFileSync(p, 'utf8'); @@ -23,7 +23,7 @@ export function getJSON(key) { export function setJSON(key, val) { return new Promise((resolve, reject) => { - const p = path.resolve(__dirname, "../config.json"); + const p = path.resolve(__dirname, "../ionconfig.json"); const data = fs.readFileSync(p, 'utf8'); var obj = JSON.parse(data); //now it an object