Compare commits

..

No commits in common. "6efeee8ca9917a9f0ab390273fc05516ec85d03b" and "e8428f1236eed5ef34f5a682772a599fcdc1fb57" have entirely different histories.

3 changed files with 5 additions and 34 deletions

View File

@ -2,14 +2,14 @@
let old_head = "<html><style>body { background-color:white;color:black; }</style><body>"
let new_head = (
["<html><head><title>Torrent Stats</title><link type="text/css" rel="stylesheet" href="https://files.hyperreal.coffee/css/main-style.css"/></head><body><h4>Last updated:", (date now | format date "%F %T%:z"), "</h4>"]
["<html><head><title>Torrent Stats</title><link type="text/css" rel="stylesheet" href="style2.css"/></head><body><h4>Last updated:", (date now | format date "%F %T%:z"), "</h4>"]
| str join ' '
)
(
/home/jas/admin-scripts/list_torrents.py
transmission-remote -l
| from ssv
| to html
| str replace ($old_head) ($new_head)
| save -f -r /home/jas/public/html/torrents.html
| save -f -r /home/jas/public/html/torrentstats.html
)

View File

@ -48,7 +48,7 @@ def print_table():
qb.login()
table = []
headers = ["Name", "Total Size", "Trackers Count", "Ratio", "Uploaded"]
sorted_torrents = sorted(qb.torrents(), key=lambda d: d["ratio"], reverse=True) # type: ignore
sorted_torrents = sorted(qb.torrents(), key=lambda d: d["name"]) # type: ignore
for torrent in sorted_torrents:
row = []
row.append(torrent["name"]) # type: ignore
@ -61,20 +61,6 @@ def print_table():
print(tabulate(table, headers, tablefmt="grid"))
def print_ssv():
qb = Client("http://localhost:8080/")
qb.login()
sorted_torrents = sorted(qb.torrents(), key=lambda d: d["ratio"], reverse=True) # type: ignore
print("Name Size Trackers Ratio Uploaded")
for torrent in sorted_torrents:
name = torrent["name"] # type: ignore
size = human_bytes(int(torrent["total_size"])) # type: ignore
trackers = torrent["trackers_count"] # type: ignore
ratio = torrent["ratio"] # type: ignore
uploaded = human_bytes(int(torrent["uploaded"])) # type: ignore
print(f"{name} {size} {trackers} {ratio} {uploaded}")
if __name__ == "__main__":
args = docopt(__doc__) # type: ignore
print_ssv()
print_table()

View File

@ -1,15 +0,0 @@
#!/usr/bin/env nu
let old_head = "<html><style>body { background-color:white;color:black; }</style><body>"
let new_head = (
["<html><head><title>Torrent Stats</title><link type="text/css" rel="stylesheet" href="https://files.hyperreal.coffee/css/main-style.css"/></head><body><h4>Last updated:", (date now | format date "%F %T%:z"), "</h4>"]
| str join ' '
)
(
/home/jas/admin-scripts/list_torrents.py
| from ssv -m 2
| to html
| str replace ($old_head) ($new_head)
| save -f -r /home/jas/public/html/torrents.html
)