ani-cli-npm 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/index.js CHANGED
@@ -171,11 +171,11 @@ async function download(url, name){
171
171
  console.log(colors.Red, "Feature not implemented yet. Sorry for any inconvenience.\nIf you need to download a video, request the link, then download it via your internet browser of choice.")
172
172
  }
173
173
 
174
- async function selection(options, prompt){
174
+ async function selection(options, prompt, extra_options = []){
175
175
  let selection = 0
176
- while (!(selection <= options && selection > 1)){
176
+ while (true){
177
177
  selection = (await input(prompt))
178
- if (selection <= options && selection >= 1){
178
+ if ((selection <= options && selection >= 1) || extra_options.includes(selection)){
179
179
  break
180
180
  }
181
181
  console.log(colors.Red,`Please input a valid option.`)
@@ -268,25 +268,23 @@ async function generate_link(provider, id){
268
268
  }
269
269
  }
270
270
 
271
- async function get_video_quality_m3u8(){
272
- console.log(colors.Red, "Not sure how you even got to this function? Its not implemented yet.")
273
- }
274
-
275
271
  async function post_play(link, anime, player="VLC"){
276
272
  while (true){
277
273
  console.log(colors.Yellow, `Playing episode ${anime.episode_number+1} of ${anime.anime_id.replaceAll("-", " ")}\n`)
278
- console.log(colors.Cyan, "1) Show Link")
279
- console.log(colors.Cyan, "2) Next Episode")
280
- console.log(colors.Cyan, "3) Prev Episode")
281
- console.log(colors.Cyan, "4) Quit")
282
- choice = parseInt(await input("select;"))
274
+ console.log(colors.Cyan, "1/l) Show Link")
275
+ console.log(colors.Cyan, "2/n) Next Episode")
276
+ console.log(colors.Cyan, "3/p) Prev Episode")
277
+ console.log(colors.Cyan, "4/q) Quit")
278
+ choice = (await selection(4, "select;", ["l", "n", "p", "q"]))
283
279
  switch (choice){
284
- case 1:
280
+ case "l":
281
+ case "1":
285
282
  console.clear()
286
283
  console.log(colors.Blue, "ANI-CLI-NPM \n")
287
284
  console.log(colors.Yellow, "Link: "+link)
288
285
  break
289
- case 2:
286
+ case "n":
287
+ case "2":
290
288
  if (anime.episode_number > anime.episodes.length-2){
291
289
  console.clear()
292
290
  console.log(colors.Red, "Damn, all out of episodes?")
@@ -298,7 +296,8 @@ async function post_play(link, anime, player="VLC"){
298
296
  process.exit()
299
297
  break
300
298
  //EVEN MORE NEEDLESS QUIT STATEMENTS!!!!!!
301
- case 3:
299
+ case "p":
300
+ case "3":
302
301
  if (anime.episode_number < 2){
303
302
  console.clear()
304
303
  console.log(colors.Red, "Error; Episode 0 is only available for premium members")
@@ -309,7 +308,8 @@ async function post_play(link, anime, player="VLC"){
309
308
  await play(link, anime, config.player)
310
309
  process.exit()
311
310
  break
312
- case 4:
311
+ case "q":
312
+ case "4":
313
313
  console.clear()
314
314
  await main()
315
315
  process.exit()
@@ -359,22 +359,26 @@ async function search(){
359
359
  if (link.includes("animixplay.to")){
360
360
  console.log(colors.Red, "Warning; VLC compatability for animix.to is currently shaky at best. It is advised to change player to browser in conf")
361
361
  }
362
- console.log(colors.Cyan, "1) Play")
363
- console.log(colors.Cyan, "2) Download")
364
- console.log(colors.Cyan, "3) Show Link")
365
- console.log(colors.Cyan, "4) quit")
366
- choice = parseInt(await input("select;"))
362
+ console.log(colors.Cyan, "1/p) Play")
363
+ console.log(colors.Cyan, "2/d) Download")
364
+ console.log(colors.Cyan, "3/l) Show Link")
365
+ console.log(colors.Cyan, "4/q) quit")
366
+ choice = (await selection(4, "select;", "q", "d", "l", "q"))
367
367
  switch (choice){
368
- case 1:
368
+ case "p":
369
+ case "1":
369
370
  await play(link, anime, config.player)
370
371
  break
371
- case 2:
372
+ case "d":
373
+ case "2":
372
374
  download(link, anime.anime_id+anime.episode_number+".mp4")
373
375
  break
374
- case 3:
376
+ case "l":
377
+ case "3":
375
378
  console.log(colors.Yellow, "Link: "+link)
376
379
  break
377
- case 4:
380
+ case "q":
381
+ case "4":
378
382
  await main()
379
383
  process.exit()
380
384
  }
@@ -384,16 +388,17 @@ async function search(){
384
388
  console.clear()
385
389
  console.log(colors.Blue, "Welcome to Ani-Cli-npm")
386
390
  async function main(){
387
- console.log(colors.Cyan, "1) Search")
388
- console.log(colors.Cyan, "2) config")
389
- console.log(colors.Cyan, "3) quit")
390
- let choice = parseInt(await input("select;"))
391
-
391
+ console.log(colors.Cyan, "1/s) Search")
392
+ console.log(colors.Cyan, "2/c) config")
393
+ console.log(colors.Cyan, "3/q) quit")
394
+ let choice = await selection(3, "select;", ["s", "c", "q"])
392
395
  switch (choice){
393
- case 1:
396
+ case "s":
397
+ case "1":
394
398
  await search()
395
399
  break
396
- case 2:
400
+ case "c":
401
+ case "2":
397
402
  let temp = structuredClone(config);
398
403
  let exit_code;
399
404
  while (true) {
@@ -415,6 +420,7 @@ async function main(){
415
420
  }
416
421
  await main()
417
422
  break
423
+ case "q":
418
424
  case 3:
419
425
  console.log(colors.Black, "Exiting...")
420
426
  process.exit()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ani-cli-npm",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "ani-cli tool rewritten as npm package",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/bin/m3u8.html DELETED
@@ -1,25 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset=utf-8 />
5
- <title>Your title</title>
6
-
7
-
8
- <link href="https://unpkg.com/video.js/dist/video-js.css" rel="stylesheet">
9
- <script src="https://unpkg.com/video.js/dist/video.js"></script>
10
- <script src="https://unpkg.com/videojs-contrib-hls/dist/videojs-contrib-hls.js"></script>
11
-
12
- </head>
13
- <body>
14
- <video id="my_video_1" class="video-js vjs-fluid vjs-default-skin" controls preload="auto"
15
- data-setup='{}'>
16
- <source src="https://wwwx15.gogocdn.stream/videos/hls/9eFQ7px5SMNenAhqSxX2Ag/1666711528/97714/012ef98641ababee475564c70e8ebc93/ep.1.1657688701.m3u8" type="application/x-mpegURL">
17
- </video>
18
-
19
- <script>
20
- var player = videojs('my_video_1');
21
- player.play();
22
- </script>
23
-
24
- </body>
25
- </html>