feat: add /info command, pt. 3
Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
This commit is contained in:
parent
270e1630d4
commit
1054299ed7
2 changed files with 18 additions and 3 deletions
|
@ -11,6 +11,14 @@ def humanize_tags_from_json(value: str, default: str) -> str:
|
|||
return default
|
||||
|
||||
|
||||
def humanize_filesize(value: int) -> str:
|
||||
for unit in ['B', 'KiB', 'MiB', 'GiB']:
|
||||
if value < 1024 or unit == 'GiB':
|
||||
break
|
||||
value /= 1024
|
||||
return f"{value:.2f} {unit}"
|
||||
|
||||
|
||||
def format_rating(value: str) -> str | None:
|
||||
match value:
|
||||
case "g":
|
||||
|
@ -48,6 +56,7 @@ def format_status(data) -> str:
|
|||
status.append("Banned")
|
||||
return " ".join(status)
|
||||
|
||||
|
||||
def get_json(pathname: str) -> Any | None:
|
||||
r = requests.get(f"http://{app.host}/{pathname}.json")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue