aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjan <jan@ruken.pw>2016-09-25 20:28:51 (UTC)
committerjan <jan@ruken.pw>2016-09-25 20:28:51 (UTC)
commit265ea9e217f15ef387a5580d9b21a1914308389c (patch)
treea53a6c98e5e302e7712b55c03d5bdd11bf497471 /src
initial commit
Diffstat (limited to 'src')
-rw-r--r--src/character.rs3
-rw-r--r--src/main.rs26
-rw-r--r--src/pre_process.rs13
3 files changed, 42 insertions, 0 deletions
diff --git a/src/character.rs b/src/character.rs
new file mode 100644
index 0000000..9c548c1
--- /dev/null
+++ b/src/character.rs
@@ -0,0 +1,3 @@
1pub struct Character {
2
3} \ No newline at end of file
diff --git a/src/main.rs b/src/main.rs
new file mode 100644
index 0000000..ca9b1c5
--- /dev/null
+++ b/src/main.rs
@@ -0,0 +1,26 @@
1extern crate regex;
2use regex::Regex;
3
4extern crate walkdir;
5use walkdir::WalkDir;
6
7use std::io::prelude::*;
8use std::fs::File;
9use std::env;
10use std::path::{Path, PathBuf};
11
12mod pre_process;
13
14fn main() {
15 let raw_files = env::var("RAW_FILES").unwrap_or("S:\\grilist\\acd\\acd_character_parser\\characters\\".into());
16 let base_path = Path::new(&raw_files);
17
18 for entry in WalkDir::new(base_path).min_depth(1).into_iter().filter_map(|e| e.ok()) {
19 println!("{:?}", entry.path());
20 let mut f = File::open(entry.path()).expect("could not open file");
21 let mut buf = String::new();
22 f.read_to_string(&mut buf).unwrap();
23
24 let buf = pre_process::strip_irrelevant_content(&buf);
25 }
26}
diff --git a/src/pre_process.rs b/src/pre_process.rs
new file mode 100644
index 0000000..aa55bd8
--- /dev/null
+++ b/src/pre_process.rs
@@ -0,0 +1,13 @@
1pub fn strip_irrelevant_content(s: &str) -> String {
2 let mut retn = "";
3 match s.find(r#"<div class=profile id=profile>"#) {
4 Some(pos) => retn = &s[pos..],
5 None => (),
6 };
7
8 match s.find(r#"<INPUT style="font-size: 2em;" TYPE=SUBMIT NAME="votes" VALUE="Cast Votes">"#) {
9 Some(pos) => retn = &s[..pos],
10 None => (),
11 };
12 return retn.into();
13} \ No newline at end of file