some lil fixes

This commit is contained in:
Mars 2024-06-22 14:52:17 -04:00
parent 875b9c7dd1
commit 2cd3ace0c8
2 changed files with 24 additions and 22 deletions

View file

@ -18,6 +18,8 @@ struct NowPlaying {
};
struct Weather {
bool enabled = false;
Location location;
string api_key;
string units;

View file

@ -60,6 +60,18 @@ fn main()->i32 {
future<string> dateFuture = std::async(std::launch::async, GetDate);
future<u64> memInfoFuture = std::async(std::launch::async, GetMemInfo);
const bool nowPlayingEnabled = nowPlayingEnabledFuture.get();
const string version = osVersionFuture.get();
const string date = dateFuture.get();
const string name = config.general.get().name.get();
const u64 mem = memInfoFuture.get();
fmt::println("Hello {}!", name);
fmt::println("Today is: {}", date);
fmt::println("Installed RAM: {:.2f}", BytesToGiB(mem));
fmt::println("{}", version);
if (config.weather.get().enabled) {
const auto
[clouds,
tz,
@ -76,23 +88,11 @@ fn main()->i32 {
dt,
id,
wind] = weatherFuture.get();
const i64 temp = std::lround(main.temp);
const bool nowPlayingEnabled = nowPlayingEnabledFuture.get();
const string version = osVersionFuture.get();
const string date = dateFuture.get();
const string name = config.general.get().name.get();
const u64 mem = memInfoFuture.get();
fmt::println("Hello {}!", name);
fmt::println("Today is: {}", date);
fmt::println("It is {}°F in {}", temp, townName);
fmt::println("Installed RAM: {:.2f}", BytesToGiB(mem));
fmt::println("{}", version);
}
if (nowPlayingEnabled)
fmt::println("{}", GetNowPlaying());
delete &config;
}