Change output

This commit is contained in:
flyingscorpio@arch-desktop 2020-05-06 11:59:42 +02:00
parent 5ec1b1ca14
commit af5fc9c48c

View file

@ -7,6 +7,7 @@ Author: flyingscorpio
from datetime import datetime
import json
import locale
import os
from pathlib import Path
import subprocess
@ -66,17 +67,19 @@ def print_to_output(confirmed: int, today_confirmed_int: int,
deaths: int, today_deaths_int: int) -> None:
"""Format the data for the i3block."""
locale.setlocale(locale.LC_ALL, '')
if today_confirmed_int >= 0:
today_confirmed = f"↑{today_confirmed_int}"
today_confirmed = f"↑{today_confirmed_int:n}"
else:
today_confirmed = f"↓{today_confirmed_int}"
today_confirmed = f"↓{today_confirmed_int:n}"
if today_deaths_int >= 0:
today_deaths = f"↑{today_deaths_int}"
today_deaths = f"↑{today_deaths_int:n}"
else:
today_deaths = f"↓{today_deaths_int}"
today_deaths = f"↓{today_deaths_int:n}"
output = f"{confirmed} ({today_confirmed}) ✝ {deaths} ({today_deaths})"
output = f"{confirmed:n} ({today_confirmed}) ✝ {deaths:n} ({today_deaths})"
print(output)
@ -84,8 +87,6 @@ def print_to_output(confirmed: int, today_confirmed_int: int,
def generate_graph(data: List[int]) -> None:
"""Generate a small graph based on the evolution of numbers in the list."""
print(data[0:20])
data = [number // 1000 for number in data]
X = range(len(data))
plt.plot(X, [data[i] for i in X])
plt.show()