mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-07-22 03:44:48 +02:00
weather: remove dupes in forecast if no change
This commit is contained in:
parent
0559c830ef
commit
85b56cd2d5
2 changed files with 9 additions and 3 deletions
|
@ -152,11 +152,17 @@ if __name__ == "__main__":
|
|||
logger.info(f"current weather: {description}")
|
||||
|
||||
# Format output
|
||||
output = "{} {} {}".format(
|
||||
forecasts = [
|
||||
format_weather(forecast_weather["list"][0]),
|
||||
format_weather(forecast_weather["list"][1]),
|
||||
format_weather(forecast_weather["list"][2]),
|
||||
)
|
||||
]
|
||||
while len(forecasts) >= 2:
|
||||
if forecasts[-1] == forecasts[-2]:
|
||||
forecasts.pop()
|
||||
else:
|
||||
break
|
||||
output = " ".join(forecasts)
|
||||
output = output.replace("%{Tx}", "%%{T%d}" % options.font)
|
||||
logger.debug("output: %s", output)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[Unit]
|
||||
Description=Build and display wallpaper
|
||||
Description=Update weather for Polybar
|
||||
PartOf=graphical-session.target
|
||||
After=polybar.service
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue