pub fn nyaadle_logic(items: Vec<rss::Item>, watch_list: Vec<Watchlist>, check: bool) {
    let chk = check;
    let non_opt = String::from("non-vid");
    let mut num_dl: u8 = 0;
    println!("Checking watch-list...\n");
    for anime in watch_list {
        // Transform anime into a string so it would be usable in the comparison.
        let title = anime.title;
        let option = anime.option;
        if title.is_empty() {
            warn!("Watch-list not found.");
            println!("Please set a watch-list by running 'nyaadle tui --watch-list'");
            break;
        } else {
            println!("Checking for {}", &title);
            // Iterate in the array items
            for item in &items {
                // Compare the 'title' and the 'item' to see if it's in the watch-list
                let check = item.title().expect("Failed to extract Post title");
                if check.contains(&title) {
                    if option == non_opt {
                        if chk {
                            println!("Found {}\n", &check);
                            continue;
                        } else {
                            let result = download_logic(item, &title);
                            num_dl += result;
                        }
                    } else if option == *"" {
                        warn!("Download Option not found.");
                        println!("Please set a download option using 'nyaadle tui --watch-list'");
                        break;
                    } else if check.contains(&option) {
                        if chk {
                            println!("Found {}\n", &check);
                            continue;
                        } else {
                            let result = download_logic(item, &title);
                            num_dl += result;
                        }
                    }
                }
            }
        }
    }
    if num_dl == 0 {
        info!("No items downloaded. Nyaadle closed.");
    } else {
        info!("{} items downloaded. Nyaadle closed.", num_dl);
    }
}
/// Main logic for the function.
/// The function iterates on the Vector `watch_list` and compares it to the `items` returned by the website.
/// This function also checks for the download option that is set by the user.
/// There can be two download options:
/// - A resolution number. This is used for video items.
///     Example: `1080p`, `720p`, `480p`
/// - `non-vid`. This is used for other items such as Books, Software, or Audio.
Main logic for the function.
The function iterates on the Vector `watch_list` and compares it to the `items` returned by the website.
This function also checks for the download option that is set by the user.
There can be two download options:
A resolution number. This is used for video items.
Main logic for the function . The function iterates on the Vector ` watch_list ` and compares it to the ` items ` returned by the website . This function also checks for the download option that is set by the user . There can be two download options : A resolution number . This is used for video items .
pub fn nyaadle_logic(items: Vec<rss::Item>, watch_list: Vec<Watchlist>, check: bool) {
    let chk = check;
    let non_opt = String::from("non-vid");
    let mut num_dl: u8 = 0;
    println!("Checking watch-list...\n");
    for anime in watch_list {
        // Transform anime into a string so it would be usable in the comparison.
        let title = anime.title;
        let option = anime.option;
        if title.is_empty() {
            warn!("Watch-list not found.");
            println!("Please set a watch-list by running 'nyaadle tui --watch-list'");
            break;
        } else {
            println!("Checking for {}", &title);
            // Iterate in the array items
            for item in &items {
                // Compare the 'title' and the 'item' to see if it's in the watch-list
                let check = item.title().expect("Failed to extract Post title");
                if check.contains(&title) {
                    if option == non_opt {
                        if chk {
                            println!("Found {}\n", &check);
                            continue;
                        } else {
                            let result = download_logic(item, &title);
                            num_dl += result;
                        }
                    } else if option == *"" {
                        warn!("Download Option not found.");
                        println!("Please set a download option using 'nyaadle tui --watch-list'");
                        break;
                    } else if check.contains(&option) {
                        if chk {
                            println!("Found {}\n", &check);
                            continue;
                        } else {
                            let result = download_logic(item, &title);
                            num_dl += result;
                        }
                    }
                }
            }
        }
    }
    if num_dl == 0 {
        info!("No items downloaded. Nyaadle closed.");
    } else {
        info!("{} items downloaded. Nyaadle closed.", num_dl);
    }
}
pub fn nyaadle_logic ( items : Vec < rss :: Item > , watch_list : Vec < Watchlist > , check : bool ) { let chk = check ; let non_opt = String :: from ( " " ) ; let mut num_dl : u8 = 0 ; println ! ( " \n " ) ; for anime in watch_list { // Transform anime into a string so it would be usable in the comparison. let title = anime . title ; let option = anime . option ; if title . is_empty ( ) { warn ! ( " " ) ; println ! ( " " ) ; break ; } else { println ! ( " " title ) ; // Iterate in the array items for item in & items { // Compare the 'title' and the 'item' to see if it's in the watch-list let check = item . title ( ) . expect ( " " ) ; if check . contains ( & title ) { if option == non_opt { if chk { println ! ( " \n " check ) ; continue ; } else { let result = download_logic ( item , & title ) ; num_dl += result ; } } else if option == * " " { warn ! ( " " ) ; println ! ( " " ) ; break ; } else if check . contains ( & option ) { if chk { println ! ( " \n " check ) ; continue ; } else { let result = download_logic ( item , & title ) ; num_dl += result ; } } } } } } if num_dl == 0 { info ! ( " " ) ; } else { info ! ( " " num_dl ) ; } }
Main logic for the function.
Main logic for the function .
items
Vec<rss::Item>
watch_list
Vec<Watchlist>
check
bool
items
Vec<rss::Item>
watch_list
Vec<Watchlist>
check
bool