aboutsummaryrefslogtreecommitdiff
path: root/src/character.rs
diff options
context:
space:
mode:
authorjan <jan@ruken.pw>2016-10-01 10:45:55 (UTC)
committerjan <jan@ruken.pw>2016-10-01 10:45:55 (UTC)
commitad63b49b94bf4b4596e6420e37d265a57b77d731 (patch)
tree73234b1a5f4d34e6b1771e4309374fd05bebd881 /src/character.rs
parenta6b37fa5e1bd505adfae4888896be2a3aa49ec3a (diff)
config entfernt, extra details parsen
Diffstat (limited to 'src/character.rs')
-rw-r--r--src/character.rs21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/character.rs b/src/character.rs
index 98c4850..b82ac18 100644
--- a/src/character.rs
+++ b/src/character.rs
@@ -1,5 +1,8 @@
1use super::tags::Tag; 1use super::tags::Tag;
2use super::traits::Trait; 2use super::dl_list::DLListItem;
3use super::section::Section;
4
5use std::collections::HashMap;
3 6
4#[derive(Debug)] 7#[derive(Debug)]
5pub struct Names { 8pub struct Names {
@@ -16,8 +19,8 @@ pub struct Images {
16 19
17#[derive(Debug)] 20#[derive(Debug)]
18pub struct Traits { 21pub struct Traits {
19 pub official: Vec<Trait>, 22 pub official: Vec<DLListItem>,
20 pub indexed: Vec<Trait>, 23 pub indexed: Vec<DLListItem>,
21} 24}
22 25
23#[derive(Debug)] 26#[derive(Debug)]
@@ -26,6 +29,18 @@ pub struct Character {
26 pub image: Images, 29 pub image: Images,
27 pub tags: Vec<Tag>, 30 pub tags: Vec<Tag>,
28 pub traits: Traits, 31 pub traits: Traits,
32 pub extra: Vec<DLListItem>,
29 33
30 pub role: Option<String> 34 pub role: Option<String>
31} 35}
36
37pub fn get_sections() -> HashMap<String, Section> {
38 let mut s: HashMap<String, Section> = HashMap::new();
39
40 s.insert("name".into(), Section::new("name", r#"(?is)Romaji Name.*?<TD>(.*?)\s?</TD>.*?Japanese Name.*?<TD>(.*?)\s?</TD>.*?Aliases.*?<TD>(.*?)\s?</TD>"#, vec!["romaji", "japanese", "aliases"]));
41 s.insert("misc".into(), Section::new("misc", r#"(?is)Role</TH>.*?<TD>(.*?)\s?</TD>"#, vec!["role"]));
42 s.insert("image".into(), Section::new("image", r#"(?is)<H3 id="section99">.*<img src="(.*?)" alt=.*?></a><p><a href="(.*?)">View Full Size Image"#, vec!["thumb", "full"]));
43 s.insert("tags".into(), Section::new("tags", r#"(?is)tagged as</P>.*?<TH>(.*?)</TH>"#, vec!["tags_raw"]));
44 s.insert("traits".into(), Section::new("traits", r#"(?is)indexed traits</P>.*?<dl>(.*?)</dl>.*?official traits\s?</P>.*?<dl>(.*?)</dl>"#, vec!["indexed_raw", "official_raw"]));
45 s
46}