some lil fixes
This commit is contained in:
parent
875b9c7dd1
commit
2cd3ace0c8
|
@ -18,6 +18,8 @@ struct NowPlaying {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Weather {
|
struct Weather {
|
||||||
|
bool enabled = false;
|
||||||
|
|
||||||
Location location;
|
Location location;
|
||||||
string api_key;
|
string api_key;
|
||||||
string units;
|
string units;
|
||||||
|
|
44
src/main.cpp
44
src/main.cpp
|
@ -60,25 +60,6 @@ fn main()->i32 {
|
||||||
future<string> dateFuture = std::async(std::launch::async, GetDate);
|
future<string> dateFuture = std::async(std::launch::async, GetDate);
|
||||||
future<u64> memInfoFuture = std::async(std::launch::async, GetMemInfo);
|
future<u64> memInfoFuture = std::async(std::launch::async, GetMemInfo);
|
||||||
|
|
||||||
const auto
|
|
||||||
[clouds,
|
|
||||||
tz,
|
|
||||||
visibility,
|
|
||||||
main,
|
|
||||||
coords,
|
|
||||||
rain,
|
|
||||||
snow,
|
|
||||||
base,
|
|
||||||
townName,
|
|
||||||
weather,
|
|
||||||
sys,
|
|
||||||
cod,
|
|
||||||
dt,
|
|
||||||
id,
|
|
||||||
wind] = weatherFuture.get();
|
|
||||||
|
|
||||||
const i64 temp = std::lround(main.temp);
|
|
||||||
|
|
||||||
const bool nowPlayingEnabled = nowPlayingEnabledFuture.get();
|
const bool nowPlayingEnabled = nowPlayingEnabledFuture.get();
|
||||||
const string version = osVersionFuture.get();
|
const string version = osVersionFuture.get();
|
||||||
const string date = dateFuture.get();
|
const string date = dateFuture.get();
|
||||||
|
@ -87,12 +68,31 @@ fn main()->i32 {
|
||||||
|
|
||||||
fmt::println("Hello {}!", name);
|
fmt::println("Hello {}!", name);
|
||||||
fmt::println("Today is: {}", date);
|
fmt::println("Today is: {}", date);
|
||||||
fmt::println("It is {}°F in {}", temp, townName);
|
|
||||||
fmt::println("Installed RAM: {:.2f}", BytesToGiB(mem));
|
fmt::println("Installed RAM: {:.2f}", BytesToGiB(mem));
|
||||||
fmt::println("{}", version);
|
fmt::println("{}", version);
|
||||||
|
|
||||||
|
if (config.weather.get().enabled) {
|
||||||
|
const auto
|
||||||
|
[clouds,
|
||||||
|
tz,
|
||||||
|
visibility,
|
||||||
|
main,
|
||||||
|
coords,
|
||||||
|
rain,
|
||||||
|
snow,
|
||||||
|
base,
|
||||||
|
townName,
|
||||||
|
weather,
|
||||||
|
sys,
|
||||||
|
cod,
|
||||||
|
dt,
|
||||||
|
id,
|
||||||
|
wind] = weatherFuture.get();
|
||||||
|
const i64 temp = std::lround(main.temp);
|
||||||
|
|
||||||
|
fmt::println("It is {}°F in {}", temp, townName);
|
||||||
|
}
|
||||||
|
|
||||||
if (nowPlayingEnabled)
|
if (nowPlayingEnabled)
|
||||||
fmt::println("{}", GetNowPlaying());
|
fmt::println("{}", GetNowPlaying());
|
||||||
|
|
||||||
delete &config;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue