ani-cli-npm 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
package/bin/Anime.js CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Anime = void 0;
4
- const curl_1 = require("./curl");
5
- const regex_1 = require("./regex");
4
+ const curl_1 = require("./core_utils/curl");
5
+ const regex_1 = require("./core_utils/regex");
6
6
  const generate_link_1 = require("./generate_link");
7
- const cache_1 = require("./cache");
7
+ const cache_1 = require("./file_managment/cache");
8
8
  const input_1 = require("./input");
9
- const load_config_1 = require("./load_config");
9
+ const load_config_1 = require("./file_managment/load_config");
10
10
  const W2GClient = require("w2g-client");
11
11
  const open = require("open");
12
12
  const PlayerController = require("media-player-controller");
@@ -25,6 +25,7 @@ class Anime {
25
25
  episode_list = [];
26
26
  most_recent = 0;
27
27
  player = 0;
28
+ current_pos = 0;
28
29
  async init(anime_id, cache_folder) {
29
30
  /*
30
31
  Initiate Anime object
@@ -51,6 +52,9 @@ class Anime {
51
52
  if (cache_object.most_recent != undefined) {
52
53
  this.most_recent = cache_object.most_recent;
53
54
  }
55
+ if (cache_object.position != undefined) {
56
+ this.current_pos = cache_object.position;
57
+ }
54
58
  }
55
59
  catch {
56
60
  await this.get_ep_bases(this.id);
@@ -116,13 +120,13 @@ class Anime {
116
120
  - If set to Link, it will simply print the media stream link to console, primarily for debuting peruses.
117
121
  */
118
122
  console.clear();
119
- console.log(`Playing ${this.id} episode ${episode + 1}`);
123
+ console.log(`Playing ${this.id} episode ${episode + 1} from ${new Date(this.current_pos * 1000).toISOString().slice(11, 19)}`);
120
124
  switch (config.player) {
121
125
  case "MPV":
122
126
  console.log(("Opening MPV.."));
123
127
  this.player = await new PlayerController({
124
128
  app: 'mpv',
125
- args: ['--fullscreen', '--keep-open=yes'],
129
+ args: ['--fullscreen', '--keep-open=yes', `--start=+${this.current_pos}`],
126
130
  media: await this.get_episode_link(episode, config.player),
127
131
  ipcPath: config.mpv_socket_path
128
132
  });
@@ -136,7 +140,7 @@ class Anime {
136
140
  console.log(("Opening VLC.."));
137
141
  this.player = await new PlayerController({
138
142
  app: 'vlc',
139
- args: ['--fullscreen'],
143
+ args: ['--fullscreen', `--start-time ${this.current_pos}`],
140
144
  media: await this.get_episode_link(episode, config.player),
141
145
  //httpPort: (config.vlc_socket !== 0)? config.vlc_socket : null, // HTTP port for local communication (vlc only)
142
146
  //httpPass: (config.vlc_pass !== "")? config.vlc_socket : null,
@@ -168,6 +172,26 @@ class Anime {
168
172
  console.log(await this.get_episode_link(episode, config.player));
169
173
  break;
170
174
  }
175
+ if (this.player.on !== undefined) {
176
+ this.player.on('playback', (data) => {
177
+ if (data.name == "time-pos" && data.value >= 0) {
178
+ this.current_pos = data.value;
179
+ }
180
+ });
181
+ this.player.on('app-exit', (code) => {
182
+ config.most_recent.anime_id = this.id;
183
+ config.most_recent.episode_number = episode;
184
+ config.most_recent.episode_second = this.current_pos;
185
+ (0, load_config_1.write_config)(config_dir, config);
186
+ this.most_recent = episode;
187
+ (0, cache_1.new_cache)(config_dir, {
188
+ id: this.id,
189
+ episode_list: this.episode_list,
190
+ most_recent: this.most_recent,
191
+ position: this.current_pos
192
+ });
193
+ });
194
+ }
171
195
  await this.play(episode, config, config_dir, true);
172
196
  }
173
197
  async play(episode, config, config_dir, first = false) {
@@ -207,12 +231,14 @@ class Anime {
207
231
  }
208
232
  config.most_recent.anime_id = this.id;
209
233
  config.most_recent.episode_number = episode;
234
+ config.most_recent.episode_second = this.current_pos;
210
235
  (0, load_config_1.write_config)(config_dir, config);
211
236
  this.most_recent = episode;
212
237
  (0, cache_1.new_cache)(config_dir, {
213
238
  id: this.id,
214
239
  episode_list: this.episode_list,
215
- most_recent: this.most_recent
240
+ most_recent: this.most_recent,
241
+ position: this.current_pos
216
242
  });
217
243
  let selected; // Look, I'm sorry, but there is no way I can possibly document this in a sane way. It's a dumb patch.
218
244
  do {
@@ -250,44 +276,6 @@ class Anime {
250
276
  case 3:
251
277
  break;
252
278
  }
253
- // if (episode <= 0){
254
- // switch(await selection([
255
- // "Next",
256
- // "Quit"
257
- // ], ["n", "q"])){
258
- // case 0:
259
- // await this.play(episode+1, config, config_dir)
260
- // break
261
- // case 1:
262
- // break
263
- // }
264
- // }else if(episode >= this.episode_list.length-2){
265
- // switch(await selection([
266
- // "Previous",
267
- // "Quit"
268
- // ], ["p", "q"])){
269
- // case 0:
270
- // await this.play(episode-1, config, config_dir)
271
- // break
272
- // case 1:
273
- // break
274
- // }
275
- // }else{
276
- // switch(await selection([
277
- // "Next",
278
- // "Previous",
279
- // "Quit"
280
- // ], ["n", "p", "q"])){
281
- // case 0:
282
- // await this.play(episode+1, config, config_dir)
283
- // break
284
- // case 1:
285
- // await this.play(episode-1, config, config_dir)
286
- // break
287
- // case 2:
288
- // break
289
- // }
290
- // }
291
279
  }
292
280
  async download(episode, download_folder, final_ep) {
293
281
  /*
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.curl = void 0;
4
+ const fetch = require("node-fetch");
5
+ const chalk = require("chalk");
6
+ async function curl(url, method = "GET", redirect = false) {
7
+ try {
8
+ let response = await fetch(url, {
9
+ //"agent": proxyAgent,
10
+ "headers": {
11
+ 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:99.0) Gecko/20100101 Firefox/100.0',
12
+ "X-Requested-With": "XMLHttpRequest"
13
+ },
14
+ "referrerPolicy": "origin",
15
+ "body": null,
16
+ "method": method,
17
+ "redirect": 'follow',
18
+ // "follow": 10,
19
+ }).catch(async function (err) {
20
+ console.warn(chalk.red(`Something went wrong connecting to ${url}. ${err}`));
21
+ process.exit();
22
+ });
23
+ if (redirect) {
24
+ return response.url;
25
+ }
26
+ else {
27
+ return await response.text();
28
+ }
29
+ }
30
+ catch {
31
+ console.log(chalk.red("Something went wrong in curl()"));
32
+ process.exit();
33
+ }
34
+ }
35
+ exports.curl = curl;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ // Random functions
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.range = void 0;
5
+ function range(start, end) {
6
+ let ans = [];
7
+ for (let i = start; i <= end; i++) {
8
+ ans.push(i);
9
+ }
10
+ return ans;
11
+ }
12
+ exports.range = range;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RegexParse = void 0;
4
+ function RegexParse(str, rule) {
5
+ let escapeRegex = (str) => str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
6
+ return new RegExp("^" + rule.split("*").map(escapeRegex).join(".*") + "$").test(str);
7
+ }
8
+ exports.RegexParse = RegexParse;
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.search_cache = exports.new_cache = exports.clear_cache = void 0;
27
+ const fs = __importStar(require("fs"));
28
+ function clear_cache(location, show) {
29
+ try {
30
+ console.log("ye sorry that doesnt exist yet.");
31
+ if (show) {
32
+ console.log("Cleared cache");
33
+ }
34
+ }
35
+ catch {
36
+ if (show) {
37
+ console.log("Failed to clear cache.");
38
+ }
39
+ }
40
+ }
41
+ exports.clear_cache = clear_cache;
42
+ function new_cache(location, anime) {
43
+ /*
44
+ Creates cache of Anime object, in cache file.
45
+ */
46
+ try {
47
+ fs.writeFileSync(location + "/" + anime.id + ".cache", JSON.stringify(anime));
48
+ }
49
+ catch {
50
+ console.log("Failed to write to cache");
51
+ }
52
+ }
53
+ exports.new_cache = new_cache;
54
+ function get_cache(location, anime_id) {
55
+ /*
56
+ ## Get cache by anime_id. Does not check if the cache exists.
57
+ */
58
+ return JSON.parse(fs.readFileSync(location + "/" + anime_id + ".cache").toString());
59
+ }
60
+ function search_cache(cache_folder, anime_id) {
61
+ /*
62
+ ## Searches cache folder for cache file with name of anime_id, at the location of cache_folder
63
+
64
+ ### returns boolean for weather it is found.
65
+ */
66
+ try {
67
+ if (check_cache(cache_folder, anime_id)) {
68
+ return get_cache(cache_folder, anime_id);
69
+ }
70
+ return false;
71
+ }
72
+ catch {
73
+ return false;
74
+ }
75
+ }
76
+ exports.search_cache = search_cache;
77
+ function check_cache(location, anime_id) {
78
+ return fs.readdirSync(location).includes(anime_id + ".cache");
79
+ }
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.config_ = void 0;
4
+ const chalk = require("chalk");
5
+ const input_1 = require("../input");
6
+ const configs = [
7
+ (async (temp) => {
8
+ temp.player = [
9
+ "VLC",
10
+ "BROWSER",
11
+ "MPV",
12
+ "W2G",
13
+ "LINK",
14
+ ][await (0, input_1.selection)([
15
+ "VLC - VLC media player",
16
+ "Browser - Play in default browser",
17
+ "MPV - MPV media player",
18
+ "w2g.tv - Watch together with friends in browser (Specify api token to create rooms linked to your account)",
19
+ "Link - Simply display the link in console"
20
+ ], [], ((item) => { return chalk.cyan(item); }), ((item) => { return chalk.cyan(item); }))];
21
+ // @ts-ignore
22
+ return temp, 0;
23
+ }),
24
+ (async (temp) => {
25
+ console.log(chalk.cyan("New Proxy;"));
26
+ temp.proxy = (await ((0, input_1.input)())).replaceAll(" ", "");
27
+ // @ts-ignore
28
+ return temp, 0;
29
+ }),
30
+ (async (temp) => {
31
+ console.log(chalk.cyan("New User Agent"));
32
+ temp.user_agent = await ((0, input_1.input)());
33
+ // @ts-ignore
34
+ return temp, 0;
35
+ }),
36
+ (async (temp) => {
37
+ console.log(chalk.cyan("New Downloads Folder"));
38
+ temp.download_folder = await ((0, input_1.input)());
39
+ // @ts-ignore
40
+ return temp, 0;
41
+ }),
42
+ (async (temp) => {
43
+ console.log(chalk.cyan("New socket file"));
44
+ temp.mpv_socket_path = await ((0, input_1.input)());
45
+ // @ts-ignore
46
+ return temp, 0;
47
+ }),
48
+ (async (temp) => {
49
+ console.log(chalk.cyan("New VLC socket"));
50
+ temp.vlc_socket = await ((0, input_1.input)());
51
+ // @ts-ignore
52
+ return temp, 0;
53
+ }),
54
+ (async (temp) => {
55
+ console.log(chalk.cyan("New VLC password"));
56
+ temp.vlc_pass = await ((0, input_1.input)());
57
+ // @ts-ignore
58
+ return temp, 0;
59
+ }),
60
+ (async (temp) => {
61
+ console.log(chalk.cyan("New w2g.tv api token"));
62
+ temp.w2g_api_key = await ((0, input_1.input)());
63
+ // @ts-ignore
64
+ return temp, 0;
65
+ }),
66
+ (async (temp) => {
67
+ // @ts-ignore
68
+ return temp, 1;
69
+ }),
70
+ (async (temp) => {
71
+ // @ts-ignore
72
+ return temp, 2;
73
+ })
74
+ ];
75
+ async function config_(temp) {
76
+ /*
77
+ ## Lets user change a single attribute of config. Returns new config object, and an exit code
78
+
79
+ ### 0 to continue (generic return)
80
+ ### 1 To confirm (Save and exit)
81
+ ### 2 to cancel (exit without saving changes)
82
+ */
83
+ console.clear();
84
+ console.log(chalk.blue("ANI-CLI-NPM \n"));
85
+ console.log(chalk.yellow("Config:\n"));
86
+ return configs[await (0, input_1.selection)([
87
+ "Player; " + temp.player,
88
+ "Proxy; " + temp.proxy,
89
+ "User agent; " + temp.user_agent,
90
+ "Downloads folder; " + temp.download_folder,
91
+ "Mpv socket connection file; " + temp.mpv_socket_path,
92
+ "VLC socket; " + temp.vlc_socket,
93
+ "VLC pass; " + temp.vlc_pass,
94
+ "W2G api token: " + temp.w2g_api_key,
95
+ "Save and exit",
96
+ "Exit without saving"
97
+ ], [], ((item) => { return chalk.cyan(item); }), ((item) => { return chalk.cyan(item); }))](temp);
98
+ }
99
+ exports.config_ = config_;
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.make_config_dir = exports.write_config = exports.load_config = void 0;
27
+ const fs = __importStar(require("fs"));
28
+ function make_config_dir(cache_dir, debug) {
29
+ try {
30
+ if (!fs.existsSync(cache_dir + "/"))
31
+ fs.mkdirSync(cache_dir + "/");
32
+ }
33
+ catch {
34
+ if (debug) {
35
+ console.log("Failed to make cache dir");
36
+ }
37
+ }
38
+ }
39
+ exports.make_config_dir = make_config_dir;
40
+ function write_config(cache_dir, config) {
41
+ try {
42
+ //make_config_dir(cache_dir, config.debug_mode)
43
+ fs.writeFileSync(cache_dir + "/config.conf", JSON.stringify(config), "utf-8");
44
+ }
45
+ catch {
46
+ console.log(("Failed to write to config file."));
47
+ }
48
+ }
49
+ exports.write_config = write_config;
50
+ function load_config(cache_dir) {
51
+ let config = {
52
+ player: "BROWSER",
53
+ proxy: "",
54
+ user_agent: "Mozilla/5.0 (X11; Linux x86_64; rv:99.0) Gecko/20100101 Firefox/100.0",
55
+ most_recent: {
56
+ episode_number: 0,
57
+ episode_second: 0,
58
+ anime_id: ""
59
+ },
60
+ download_folder: ".",
61
+ debug_mode: false,
62
+ mpv_socket_path: "",
63
+ vlc_socket: 0,
64
+ vlc_pass: "",
65
+ w2g_api_key: ""
66
+ };
67
+ if (fs.existsSync(cache_dir + "/config.conf")) {
68
+ // @ts-ignore
69
+ let tmp = JSON.parse(fs.readFileSync(cache_dir + "/config.conf"), "utf8");
70
+ // @ts-ignore
71
+ if (tmp.player !== undefined)
72
+ config.player = tmp.player;
73
+ // @ts-ignore
74
+ if (tmp.proxy !== undefined)
75
+ config.proxy = tmp.proxy;
76
+ // @ts-ignore
77
+ if (tmp.user_agent !== undefined)
78
+ config.user_agent = tmp.user_agent;
79
+ // @ts-ignore
80
+ if (tmp.most_recent !== undefined) {
81
+ // @ts-ignore
82
+ if (tmp.most_recent.episode_number !== undefined)
83
+ config.most_recent.episode_number = tmp.most_recent.episode_number;
84
+ // @ts-ignore
85
+ if (tmp.most_recent.anime_id !== undefined)
86
+ config.most_recent.anime_id = tmp.most_recent.anime_id;
87
+ // @ts-ignore
88
+ if (tmp.most_recent.episode_second !== undefined)
89
+ config.most_recent.episode_second = tmp.most_recent.episode_second;
90
+ }
91
+ // @ts-ignore
92
+ if (tmp.download_folder !== undefined)
93
+ config.download_folder = tmp.download_folder;
94
+ // @ts-ignore
95
+ if (tmp.mpv_socket_path !== undefined)
96
+ config.mpv_socket_path = tmp.mpv_socket_path;
97
+ // @ts-ignore
98
+ if (tmp.vlc_socket !== undefined)
99
+ config.vlc_socket = tmp.vlc_socket;
100
+ // @ts-ignore
101
+ if (tmp.vlc_pass !== undefined)
102
+ config.vlc_pass = tmp.vlc_pass;
103
+ // @ts-ignore
104
+ if (tmp.w2g_api_key !== undefined)
105
+ config.w2g_api_key = tmp.w2g_api_key;
106
+ }
107
+ write_config(cache_dir, config);
108
+ return config;
109
+ }
110
+ exports.load_config = load_config;
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generate_link = void 0;
4
4
  const gogohd_url = "https://gogohd.net/";
5
5
  const base_url = "https://animixplay.to";
6
- const curl_1 = require("./curl");
7
- const regex_1 = require("./regex");
6
+ const curl_1 = require("./core_utils/curl");
7
+ const regex_1 = require("./core_utils/regex");
8
8
  async function generate_link(provider, id, player) {
9
9
  let html_ = "";
10
10
  let provider_name = "";
package/bin/help.js ADDED
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.help = void 0;
4
+ const input_1 = require("./input");
5
+ const chalk = require("chalk");
6
+ const helps = [
7
+ (async () => {
8
+ console.log(chalk.cyan("Playing anime: \n" +
9
+ " Search: \n" +
10
+ " Search for a show/movie. This will search on gogoanime.dk.\n" +
11
+ " Episode selection: \n" +
12
+ " Once an anime is selected, select an episode. If there is only 1 episode " +
13
+ "(in the case of a movie), the episode will be played automatically.\n" +
14
+ " The episode selected will be played in the video player selected in options. Info on video players can be found in options help."));
15
+ await help();
16
+ return;
17
+ }),
18
+ (async () => {
19
+ console.log(chalk.cyan("Downloading anime: \n" +
20
+ " Search: \n" +
21
+ " Search for a show/movie. This will search on gogoanime.dk.\n" +
22
+ " Episode selection: \n" +
23
+ " Once an anime is selected, select a start episode and an end episode. If there is only 1 episode " +
24
+ "(in the case of a movie), the episode will be downloaded automatically. Download folder can be changed in options. Default to run location.\n" +
25
+ " The selected episodes will be downloaded. It is common for episode links to fail to be fetched, when this happens the episode will be passed, then reattempted in another pass.\n" +
26
+ " Episodes sourced from Animixplay links will download m3u8 file, which you will have difficulty playing, if you are able to at all."));
27
+ await help();
28
+ return;
29
+ }),
30
+ (async () => {
31
+ console.log(chalk.cyan("Options: \n" +
32
+ " Player: \n" +
33
+ " Player used to play anime.\n" +
34
+ " Proxy: \n" +
35
+ " https proxy address and port in form ip:port. This is not currently implemented.\n" +
36
+ " User agent:\n" +
37
+ " node-fetch user agent.\n" +
38
+ " Downloads folder:\n" +
39
+ " Folder to place downloaded episodes.\n" +
40
+ " MPV socket connection file:\n" +
41
+ " File for mpv socket, used to control mpv instance with outside tools.\n" +
42
+ " VLC socket:\n" +
43
+ " VLC http control socket\n" +
44
+ " VLC pass:\n" +
45
+ " VLC http control password\n" +
46
+ " W2G api token:\n" +
47
+ " Your user access token for w2g.tv. Can be found at https://w2g.tv/en/account/edit_user under Tools/API\n"));
48
+ await help();
49
+ return;
50
+ }),
51
+ (async () => {
52
+ return;
53
+ })
54
+ ];
55
+ async function help() {
56
+ console.log(chalk.cyan("Help page select: \n"));
57
+ return helps[await (0, input_1.selection)(["Playing", "Downloading", "Options", "Quit"], ["p", "d", "o", "q"])]();
58
+ }
59
+ exports.help = help;
package/bin/index.js CHANGED
@@ -11,10 +11,11 @@ const chalk = require("chalk");
11
11
  // Internal
12
12
  const Anime_1 = require("./Anime");
13
13
  const search_anime_1 = require("./search_anime");
14
- const load_config_1 = require("./load_config");
14
+ const load_config_1 = require("./file_managment/load_config");
15
15
  const input_1 = require("./input");
16
- const change_config_1 = require("./change_config");
16
+ const change_config_1 = require("./file_managment/change_config");
17
17
  const download_1 = require("./download");
18
+ const help_1 = require("./help");
18
19
  const app_data_folder = (0, appdata_path_1.default)();
19
20
  const cache_folder = app_data_folder + "/ani-cli-npm";
20
21
  (0, load_config_1.make_config_dir)(cache_folder, true);
@@ -30,8 +31,9 @@ async function main() {
30
31
  "Continue",
31
32
  "Download",
32
33
  "Option",
34
+ "Help",
33
35
  "Quit",
34
- ], ["s", "c", "d", "o", "q"], ((thing) => { return chalk.magenta(thing); }), ((thing) => { return chalk.magenta(thing); }));
36
+ ], ["s", "c", "d", "o", "h", "q"], ((thing) => { return chalk.magenta(thing); }), ((thing) => { return chalk.magenta(thing); }));
35
37
  switch (choice) {
36
38
  case 0: // Search
37
39
  let temp_ = await (0, search_anime_1.search)();
@@ -105,7 +107,10 @@ async function main() {
105
107
  }
106
108
  await main();
107
109
  break;
108
- case 4: // Quit
110
+ case 4:
111
+ await (0, help_1.help)();
112
+ break;
113
+ case 5: // Quit
109
114
  console.log("Exit");
110
115
  }
111
116
  return 0;
@@ -96,6 +96,9 @@ function load_config(cache_dir) {
96
96
  // @ts-ignore
97
97
  if (tmp.vlc_pass !== undefined)
98
98
  config.vlc_pass = tmp.vlc_pass;
99
+ // @ts-ignore
100
+ if (tmp.w2g_api_key !== undefined)
101
+ config.w2g_api_key = tmp.w2g_api_key;
99
102
  }
100
103
  write_config(cache_dir, config);
101
104
  return config;
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.search = void 0;
7
- const regex_1 = require("./regex");
8
- const curl_1 = require("./curl");
7
+ const regex_1 = require("./core_utils/regex");
8
+ const curl_1 = require("./core_utils/curl");
9
9
  const input_1 = require("./input");
10
10
  const chalk_1 = __importDefault(require("chalk"));
11
11
  async function search_anime(search) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ani-cli-npm",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "ani-cli tool rewritten as npm package",
5
5
  "main": "bin/index.js",
6
6
  "scripts": {
package/tem.js DELETED
@@ -1,13 +0,0 @@
1
- const W2GClient = require("w2g-client")
2
-
3
- let client = new W2GClient.W2GClient("sovw9okdu5kb9vr39yy9k34u25sftalqz5ntluxshn48ooza1x5ih3yzaay6ie097z")
4
-
5
- async function main(){
6
- await client.create()
7
- console.log(client.getLink())
8
- await client.update("https://wwwx12.gogocdn.stream/videos/hls/nHDWH61tDXm9bXm7-tFVIw/1670878227/107271/f23efce39606d64216a0023544f49bb4/ep.29.1662456614.m3u8")
9
-
10
- }
11
-
12
- main()
13
-