diff --git a/rules b/rules index 28c1de32..aaf910cd 160000 --- a/rules +++ b/rules @@ -1 +1 @@ -Subproject commit 28c1de3279a62f2bf9ae01327e0df0fe4fba443a +Subproject commit aaf910cdcaca32e89b0f81b0af4e180228d21eb6 diff --git a/src/detections/configs.rs b/src/detections/configs.rs index 5a29b104..53207655 100644 --- a/src/detections/configs.rs +++ b/src/detections/configs.rs @@ -555,7 +555,7 @@ impl EventInfo { } #[derive(Debug, Clone)] pub struct EventInfoConfig { - eventinfo: HashMap, + eventinfo: HashMap<(String, String), EventInfo>, } impl Default for EventInfoConfig { @@ -570,8 +570,9 @@ impl EventInfoConfig { eventinfo: HashMap::new(), } } - pub fn get_event_id(&self, eventid: &str) -> Option<&EventInfo> { - self.eventinfo.get(eventid) + pub fn get_event_id(&self, channel: &str, eventid: &str) -> Option<&EventInfo> { + self.eventinfo + .get(&(channel.to_string(), eventid.to_string())) } } @@ -586,19 +587,21 @@ fn load_eventcode_info(path: &str) -> EventInfoConfig { // event_id_info.txtが読み込めなかったらエラーで終了とする。 read_result.unwrap().into_iter().for_each(|line| { - if line.len() != 2 { + if line.len() != 3 { return; } let empty = &"".to_string(); - let eventcode = line.get(0).unwrap_or(empty); - let event_title = line.get(1).unwrap_or(empty); + let channel = line.get(0).unwrap_or(empty); + let eventcode = line.get(1).unwrap_or(empty); + let event_title = line.get(2).unwrap_or(empty); infodata = EventInfo { evttitle: event_title.to_string(), }; - config - .eventinfo - .insert(eventcode.to_owned(), infodata.to_owned()); + config.eventinfo.insert( + (channel.to_owned(), eventcode.to_owned()), + infodata.to_owned(), + ); }); config } diff --git a/src/lib.rs b/src/lib.rs index c8f62192..655018ce 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,8 +6,5 @@ pub mod omikuji; pub mod options; pub mod timeline; pub mod yaml; -<<<<<<< HEAD -======= #[macro_use] extern crate horrorshow; ->>>>>>> d91fd31392813c79a33cf5dc10eae06db2ce2613 diff --git a/src/timeline/timelines.rs b/src/timeline/timelines.rs index 697566f0..5f0b4cbb 100644 --- a/src/timeline/timelines.rs +++ b/src/timeline/timelines.rs @@ -139,23 +139,19 @@ impl Timeline { // 件数の割合を算出 let rate: f32 = **event_cnt as f32 / self.stats.total as f32; - // channelとIDを分割 - let ch_id = event_id.split(',').fold(Vec::new(), |mut s, i| { - s.push(i.to_string()); - s - }); - println!("{:?}", ch_id); + let fmted_channel = channel.replace('\"', ""); + println!("{:?}", fmted_channel); + println!("{:?}", event_id); // イベント情報取得(eventtitleなど) let conf = CONFIG .read() .unwrap() .event_timeline_config - .get_event_id(event_id) + .get_event_id(&fmted_channel, event_id) .is_some(); // event_id_info.txtに登録あるものは情報設定 // 出力メッセージ1行作成 - let fmted_channel = channel.replace('\"', ""); let ch = CH_CONFIG .get(fmted_channel.to_lowercase().as_str()) .unwrap_or(&fmted_channel) @@ -170,7 +166,7 @@ impl Timeline { .read() .unwrap() .event_timeline_config - .get_event_id(event_id) + .get_event_id(&fmted_channel, event_id) .unwrap() .evttitle .to_string(),