mirror of
https://github.com/mrfluffy-dev/kami.git
synced 2026-01-17 04:50:32 +00:00
did some formatting
This commit is contained in:
@@ -1,14 +1,13 @@
|
|||||||
use crate::{string_input,int_input};
|
|
||||||
use crate::{anime_names,anime_ep_range,anime_link};
|
|
||||||
use crate::open_video;
|
|
||||||
use crate::main;
|
use crate::main;
|
||||||
|
use crate::open_video;
|
||||||
|
use crate::{anime_ep_range, anime_link, anime_names};
|
||||||
|
use crate::{int_input, string_input};
|
||||||
use colored::Colorize;
|
use colored::Colorize;
|
||||||
//use crate
|
//use crate
|
||||||
pub fn anime_stream(search: String, episode: u32) {
|
pub fn anime_stream(search: String, episode: u32) {
|
||||||
let query = if search != "" {
|
let query = if search != "" {
|
||||||
search
|
search
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
string_input("Search anime: ")
|
string_input("Search anime: ")
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -45,14 +44,12 @@ pub fn anime_stream(search: String, episode: u32) {
|
|||||||
let link = anime_link(title, 1);
|
let link = anime_link(title, 1);
|
||||||
open_video(link);
|
open_video(link);
|
||||||
main();
|
main();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
let mut ep_num: usize = usize::MAX;
|
let mut ep_num: usize = usize::MAX;
|
||||||
if episode > ep_range.into() {
|
if episode > ep_range.into() {
|
||||||
println!("Invalid episode number");
|
println!("Invalid episode number");
|
||||||
main();
|
main();
|
||||||
}
|
} else if episode != 0 {
|
||||||
else if episode != 0{
|
|
||||||
ep_num = episode as usize;
|
ep_num = episode as usize;
|
||||||
} else {
|
} else {
|
||||||
println!("select episode 1-{}: ", ep_range);
|
println!("select episode 1-{}: ", ep_range);
|
||||||
@@ -88,8 +85,7 @@ pub fn anime_stream(search: String, episode: u32) {
|
|||||||
anime_stream("".to_string(), 0);
|
anime_stream("".to_string(), 0);
|
||||||
} else if input == "q" {
|
} else if input == "q" {
|
||||||
std::process::exit(0);
|
std::process::exit(0);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
println!("Invalid command");
|
println!("Invalid command");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
use crate::{chapter_selector, get_full_text, open_bat, search_ln};
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use crate::{search_ln,chapter_selector,get_full_text,open_bat};
|
|
||||||
pub fn ln_read(search: &str, chapter: u32) {
|
pub fn ln_read(search: &str, chapter: u32) {
|
||||||
//convert search in to Option<&str>
|
//convert search in to Option<&str>
|
||||||
let ln_url = search_ln(&search);
|
let ln_url = search_ln(&search);
|
||||||
@@ -19,7 +19,8 @@ pub fn ln_read(search: &str, chapter: u32){
|
|||||||
let mut home = format!("{:?}", home_dir()).replace("\\\\", "/");
|
let mut home = format!("{:?}", home_dir()).replace("\\\\", "/");
|
||||||
home.drain(0..6);
|
home.drain(0..6);
|
||||||
home.drain(home.len() - 2..home.len());
|
home.drain(home.len() - 2..home.len());
|
||||||
let mut file = File::create(format!("{}/AppData/Roaming/log_e",home)).expect("Unable to create file");
|
let mut file = File::create(format!("{}/AppData/Roaming/log_e", home))
|
||||||
|
.expect("Unable to create file");
|
||||||
file.write_all(full_text.as_bytes())
|
file.write_all(full_text.as_bytes())
|
||||||
.expect("Unable to write to file");
|
.expect("Unable to write to file");
|
||||||
file.sync_all().expect("Unable to sync file");
|
file.sync_all().expect("Unable to sync file");
|
||||||
|
|||||||
@@ -21,9 +21,17 @@ pub fn chapter_selector(ln_url: &str, mut selected_page: u32) -> (String, u32) {
|
|||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
ln_chapters.into_iter().for_each(|chaprer| {
|
ln_chapters.into_iter().for_each(|chaprer| {
|
||||||
if count % 2 == 0 {
|
if count % 2 == 0 {
|
||||||
println!("({})\t{}", count.to_string().blue(), format_args!("{}", chaprer.blue()));
|
println!(
|
||||||
|
"({})\t{}",
|
||||||
|
count.to_string().blue(),
|
||||||
|
format_args!("{}", chaprer.blue())
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
println!("({})\t{}", count.to_string().yellow(), format_args!("{}", chaprer.yellow()));
|
println!(
|
||||||
|
"({})\t{}",
|
||||||
|
count.to_string().yellow(),
|
||||||
|
format_args!("{}", chaprer.yellow())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
count += 1;
|
count += 1;
|
||||||
});
|
});
|
||||||
@@ -43,8 +51,7 @@ pub fn chapter_selector(ln_url: &str, mut selected_page: u32) -> (String, u32) {
|
|||||||
std::process::exit(0);
|
std::process::exit(0);
|
||||||
} else if chapter_number == "s" {
|
} else if chapter_number == "s" {
|
||||||
main();
|
main();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
let chapter_number = chapter_number.trim().to_string();
|
let chapter_number = chapter_number.trim().to_string();
|
||||||
let mut _chapter_number_int = 0;
|
let mut _chapter_number_int = 0;
|
||||||
if chapter_number.parse::<u32>().is_ok() {
|
if chapter_number.parse::<u32>().is_ok() {
|
||||||
|
|||||||
Reference in New Issue
Block a user