mirror of
https://github.com/Death916/deathclock.git
synced 2026-04-10 03:04:40 -07:00
add weather task and clean up dbg!
This commit is contained in:
parent
2402edb209
commit
16e5bf3d5f
3 changed files with 17 additions and 15 deletions
|
|
@ -84,7 +84,9 @@ impl RustClock {
|
||||||
self.current_time = Local::now();
|
self.current_time = Local::now();
|
||||||
Task::none()
|
Task::none()
|
||||||
}
|
}
|
||||||
Message::RunWeatherUpdate => Task::perform(weather::get_weather(), Message::UpdateWeatherImg),
|
Message::RunWeatherUpdate => {
|
||||||
|
Task::perform(weather::get_weather(), Message::UpdateWeatherImg)
|
||||||
|
}
|
||||||
Message::UpdateWeatherImg(handle) => {
|
Message::UpdateWeatherImg(handle) => {
|
||||||
self.weather_handle = Some(handle);
|
self.weather_handle = Some(handle);
|
||||||
Task::none()
|
Task::none()
|
||||||
|
|
|
||||||
|
|
@ -86,11 +86,11 @@ pub fn update_mlb() -> Vec<Game> {
|
||||||
);
|
);
|
||||||
mlb_game_struct.update(&home_score, &away_score, period);
|
mlb_game_struct.update(&home_score, &away_score, period);
|
||||||
mlb_games_vec.push(mlb_game_struct);
|
mlb_games_vec.push(mlb_game_struct);
|
||||||
dbg!("Home Team: {}", home_team);
|
dbg!(home_team);
|
||||||
dbg!("Away Team: {}", away_team);
|
dbg!(away_team);
|
||||||
dbg!("Home Score: {}", home_score);
|
dbg!(home_score);
|
||||||
dbg!("Away Score: {}", away_score);
|
dbg!(away_score);
|
||||||
dbg!("Period: {}", period);
|
dbg!(period);
|
||||||
}
|
}
|
||||||
|
|
||||||
mlb_games_vec
|
mlb_games_vec
|
||||||
|
|
@ -128,12 +128,12 @@ pub fn update_nba() -> Vec<Game> {
|
||||||
);
|
);
|
||||||
game.update(&home_score, &away_score, period);
|
game.update(&home_score, &away_score, period);
|
||||||
updated_games.push(game);
|
updated_games.push(game);
|
||||||
dbg!("Game ID: {}", game_id);
|
dbg!(game_id);
|
||||||
dbg!("Home Team: {}", home_team);
|
dbg!(home_team);
|
||||||
dbg!("Away Team: {}", away_team);
|
dbg!(away_team);
|
||||||
dbg!("Home Score: {}", home_score);
|
dbg!(home_score);
|
||||||
dbg!("Away Score: {}", away_score);
|
dbg!(away_score);
|
||||||
dbg!("Period: {}", period);
|
dbg!(period);
|
||||||
}
|
}
|
||||||
updated_games
|
updated_games
|
||||||
}
|
}
|
||||||
|
|
@ -179,11 +179,11 @@ pub fn get_nba_logos() -> HashMap<String, Vec<u8>> {
|
||||||
.header("User-Agent", "deathclock-app/0.1")
|
.header("User-Agent", "deathclock-app/0.1")
|
||||||
.call()
|
.call()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
dbg!("Response {}", response.status());
|
dbg!(chrono::Local::now(), response.status());
|
||||||
|
|
||||||
let image_data = response.into_body().read_to_vec().unwrap();
|
let image_data = response.into_body().read_to_vec().unwrap();
|
||||||
nba_svg_map.insert(team_name.to_string(), image_data);
|
nba_svg_map.insert(team_name.to_string(), image_data);
|
||||||
dbg!("Downloaded logo for {}", team_name);
|
dbg!("Downloaded logo for ", team_name);
|
||||||
}
|
}
|
||||||
nba_svg_map
|
nba_svg_map
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ pub async fn get_weather() -> Handle {
|
||||||
let handle = Some(Handle::from_bytes(image));
|
let handle = Some(Handle::from_bytes(image));
|
||||||
let handle = handle.unwrap();
|
let handle = handle.unwrap();
|
||||||
//TODO better error handling
|
//TODO better error handling
|
||||||
dbg!("updating weather");
|
dbg!(format!("{}: updating weather", chrono::Local::now()));
|
||||||
handle
|
handle
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue