<commit_before>#![feature(plugin)]
#![plugin(clippy)]

extern crate avsser;
extern crate getopts;

use getopts::Options;
use std::env;
use std::path::PathBuf;
use avsser::generic::input::get_list_of_files;
use avsser::generic::output::create_avs_script;
use avsser::generic::output::AvsOptions;

fn print_usage(program: &str, opts: Options) {
    let brief = format!("Usage: {} [options] INPUT", program);
    print!("{}", opts.usage(&brief));
}

fn main() {
    let program = env::args().next().unwrap();
    let args: Vec<String> = env::args().skip(1).collect();

    let mut opts = Options::new();
    opts.optflag("h", "help", "print this help menu");
    let matches = match opts.parse(&args) {
        Ok(m) => { m }
        Err(f) => { panic!(f.to_string()) }
    };
    if matches.opt_present("h") {
        print_usage(&program, opts);
        return;
    }
    let input = if !matches.free.is_empty() {
        matches.free[0].clone()
    } else {
        print_usage(&program, opts);
        return;
    };

    let input = get_list_of_files(PathBuf::from(input), false).ok().expect("Unable to read input file(s)");
    for file in input {
        let path = PathBuf::from(file);
        create_avs_script(
            path.clone(),
            path.with_extension("avs"),
            AvsOptions {
                remove_grain: Some(1)<commit_msg>Skip files that aren't videos<commit_after>#![feature(plugin)]
#![plugin(clippy)]

extern crate avsser;
extern crate getopts;

use getopts::Options;
use std::env;
use std::path::PathBuf;
use avsser::generic::input::get_list_of_files;
use avsser::generic::input::determine_input_type;
use avsser::generic::output::create_avs_script;
use avsser::generic::output::AvsOptions;

fn print_usage(program: &str, opts: Options) {
    let brief = format!("Usage: {} [options] INPUT", program);
    print!("{}", opts.usage(&brief));
}

fn main() {
    let program = env::args().next().unwrap();
    let args: Vec<String> = env::args().skip(1).collect();

    let mut opts = Options::new();
    opts.optflag("h", "help", "print this help menu");
    let matches = match opts.parse(&args) {
        Ok(m) => { m }
        Err(f) => { panic!(f.to_string()) }
    };
    if matches.opt_present("h") {
        print_usage(&program, opts);
        return;
    }
    let input = if !matches.free.is_empty() {
        matches.free[0].clone()
    } else {
        print_usage(&program, opts);
        return;
    };

    let input = get_list_of_files(PathBuf::from(input), false).ok().expect("Unable to read input file(s)");
    for file in input {
        if determine_input_type(file.clone()).is_none() {
            continue;
        }
        let path = PathBuf::from(file);
        create_avs_script(
            path.clone(),
            path.with_extension("avs"),
            AvsOptions {
                remove_grain: Some(1)
{'fraction_non_alphanumeric': 0.16956824512534818, 'fraction_numerical': 0.0020891364902506965, 'mean_word_length': 3.104285714285714, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7165717', 'n_tokens_mistral': 939, 'n_tokens_neox': 934, 'n_words': 198}