Change output
This commit is contained in:
parent
5ec1b1ca14
commit
af5fc9c48c
1 changed files with 8 additions and 7 deletions
|
@ -7,6 +7,7 @@ Author: flyingscorpio
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import json
|
import json
|
||||||
|
import locale
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import subprocess
|
import subprocess
|
||||||
|
@ -66,17 +67,19 @@ def print_to_output(confirmed: int, today_confirmed_int: int,
|
||||||
deaths: int, today_deaths_int: int) -> None:
|
deaths: int, today_deaths_int: int) -> None:
|
||||||
"""Format the data for the i3block."""
|
"""Format the data for the i3block."""
|
||||||
|
|
||||||
|
locale.setlocale(locale.LC_ALL, '')
|
||||||
|
|
||||||
if today_confirmed_int >= 0:
|
if today_confirmed_int >= 0:
|
||||||
today_confirmed = f"↑{today_confirmed_int}"
|
today_confirmed = f"↑{today_confirmed_int:n}"
|
||||||
else:
|
else:
|
||||||
today_confirmed = f"↓{today_confirmed_int}"
|
today_confirmed = f"↓{today_confirmed_int:n}"
|
||||||
|
|
||||||
if today_deaths_int >= 0:
|
if today_deaths_int >= 0:
|
||||||
today_deaths = f"↑{today_deaths_int}"
|
today_deaths = f"↑{today_deaths_int:n}"
|
||||||
else:
|
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)
|
print(output)
|
||||||
|
|
||||||
|
@ -84,8 +87,6 @@ def print_to_output(confirmed: int, today_confirmed_int: int,
|
||||||
def generate_graph(data: List[int]) -> None:
|
def generate_graph(data: List[int]) -> None:
|
||||||
"""Generate a small graph based on the evolution of numbers in the list."""
|
"""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))
|
X = range(len(data))
|
||||||
plt.plot(X, [data[i] for i in X])
|
plt.plot(X, [data[i] for i in X])
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
Loading…
Add table
Reference in a new issue