added a search another title option to anime

This commit is contained in:
Zastian Pretorius
2022-07-11 19:40:03 +01:00
parent f9ece6bcc7
commit 7b02787e62
2 changed files with 7 additions and 3 deletions

View File

@@ -4,8 +4,8 @@ use crate::open_video;
use crate::main; use crate::main;
use colored::Colorize; use colored::Colorize;
//use crate //use crate
pub fn anime_stream(){ pub fn anime_stream(first_run: bool) {
let query = if std::env::args().len() > 2 { let query = if std::env::args().len() > 2 && first_run {
std::env::args().nth(2).unwrap() std::env::args().nth(2).unwrap()
} else { } else {
string_input("Enter query: ") string_input("Enter query: ")
@@ -58,6 +58,7 @@ pub fn anime_stream(){
open_video(link); open_video(link);
println!("{}","n: next episode".green()); println!("{}","n: next episode".green());
println!("{}","p: previous episode".yellow()); println!("{}","p: previous episode".yellow());
println!("{}","s: search another anime".green());
println!("{}","q: quit".red()); println!("{}","q: quit".red());
let input = string_input("Enter command: "); let input = string_input("Enter command: ");
if input == "n" { if input == "n" {
@@ -72,6 +73,9 @@ pub fn anime_stream(){
} else { } else {
ep_num -= 1; ep_num -= 1;
} }
} else if input == "s" {
//remove all the arguments
anime_stream(false);
} else if input == "q" { } else if input == "q" {
std::process::exit(0); std::process::exit(0);
} }

View File

@@ -32,7 +32,7 @@ fn main() {
if _arg == "l" { if _arg == "l" {
ln_read(); ln_read();
} else if _arg == "a" { } else if _arg == "a" {
anime_stream() anime_stream(true)
} else { } else {
println!("Invalid argument"); println!("Invalid argument");
} }