mirror of
https://codeberg.org/hyperreal/admin-scripts
synced 2024-11-25 17:13:41 +01:00
Compare commits
No commits in common. "6efeee8ca9917a9f0ab390273fc05516ec85d03b" and "e8428f1236eed5ef34f5a682772a599fcdc1fb57" have entirely different histories.
6efeee8ca9
...
e8428f1236
@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
let old_head = "<html><style>body { background-color:white;color:black; }</style><body>"
|
let old_head = "<html><style>body { background-color:white;color:black; }</style><body>"
|
||||||
let new_head = (
|
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 ' '
|
| str join ' '
|
||||||
)
|
)
|
||||||
|
|
||||||
(
|
(
|
||||||
/home/jas/admin-scripts/list_torrents.py
|
transmission-remote -l
|
||||||
| from ssv
|
| from ssv
|
||||||
| to html
|
| to html
|
||||||
| str replace ($old_head) ($new_head)
|
| str replace ($old_head) ($new_head)
|
||||||
| save -f -r /home/jas/public/html/torrents.html
|
| save -f -r /home/jas/public/html/torrentstats.html
|
||||||
)
|
)
|
||||||
|
@ -48,7 +48,7 @@ def print_table():
|
|||||||
qb.login()
|
qb.login()
|
||||||
table = []
|
table = []
|
||||||
headers = ["Name", "Total Size", "Trackers Count", "Ratio", "Uploaded"]
|
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:
|
for torrent in sorted_torrents:
|
||||||
row = []
|
row = []
|
||||||
row.append(torrent["name"]) # type: ignore
|
row.append(torrent["name"]) # type: ignore
|
||||||
@ -61,20 +61,6 @@ def print_table():
|
|||||||
print(tabulate(table, headers, tablefmt="grid"))
|
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__":
|
if __name__ == "__main__":
|
||||||
args = docopt(__doc__) # type: ignore
|
args = docopt(__doc__) # type: ignore
|
||||||
print_ssv()
|
print_table()
|
||||||
|
@ -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
|
|
||||||
)
|
|
Loading…
Reference in New Issue
Block a user