diff options
author | jan <jan@ruken.pw> | 2016-09-29 11:10:20 (UTC) |
---|---|---|
committer | jan <jan@ruken.pw> | 2016-09-29 11:10:20 (UTC) |
commit | 9e59cd7e6a21751420ccbb853ac883154c6e578e (patch) | |
tree | f8497b7f12634985fb3409b9ab3343a5c0285f9f /src/main.rs | |
parent | 23942b01ada4ef30a4bf183d90650ade56255ecc (diff) |
dynamischere sektionssuche, jetzt auch mit thumb images. koennten wir eigentlich in irgendeine config-datei auslagern.
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/main.rs b/src/main.rs index b733e6f..2123c6b 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -13,15 +13,11 @@ mod pre_process; | |||
13 | use pre_process::Section; | 13 | use pre_process::Section; |
14 | 14 | ||
15 | fn main() { | 15 | fn main() { |
16 | let raw_files = env::var("RAW_FILES").unwrap_or("S:\\grilist\\acd\\acd_character_parser\\characters\\".into()); | 16 | let raw_files = env::var("RAW_FILES").unwrap_or("characters".into()); |
17 | let base_path = Path::new(&raw_files); | 17 | let base_path = Path::new(&raw_files); |
18 | 18 | ||
19 | let mut sections: Vec<Section> = vec![]; | 19 | let mut sections: Vec<Section> = vec![]; |
20 | sections.push(Section { | 20 | sections.push(Section::new("image", r#"(?is)<H3 id="section99">.*<img src="(.*?)" alt=.*?></a><p><a href="(.*?)">View Full Size Image"#, vec!["thumb".into(), "full".into()])); |
21 | name: "image".into(), | ||
22 | re: Regex::new(r#"(?is)<H3 id="section99">.*<p><a href="(.*?)">View Full Size Image"#).unwrap(), | ||
23 | content: String::new(), | ||
24 | }); | ||
25 | 21 | ||
26 | for entry in WalkDir::new(base_path).min_depth(1).into_iter().filter_map(|e| e.ok()) { | 22 | for entry in WalkDir::new(base_path).min_depth(1).into_iter().filter_map(|e| e.ok()) { |
27 | let mut f = File::open(entry.path()).expect("could not open file"); | 23 | let mut f = File::open(entry.path()).expect("could not open file"); |
@@ -35,6 +31,6 @@ fn main() { | |||
35 | 31 | ||
36 | pre_process::split_sections(&buf, &mut sections); | 32 | pre_process::split_sections(&buf, &mut sections); |
37 | 33 | ||
38 | println!("{}", sections[0].content); | 34 | println!("{:?}", sections[0].data); |
39 | } | 35 | } |
40 | } | 36 | } |