mirror of
https://github.com/ION606/ion-cli.git
synced 2026-05-14 22:16:56 +00:00
Removed useless code
This commit is contained in:
@@ -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
|
||||
|
||||
+3
-14
@@ -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");
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user