Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-willis committed Apr 7, 2024
1 parent 08d2576 commit 35487a0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
6 changes: 5 additions & 1 deletion Netivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,9 @@ def tick(self, *_):
self.app.title = bandwidth.retrieve(self.params)


if __name__ == "__main__":
def main():
Netivity()


if __name__ == "__main__":
main()
9 changes: 4 additions & 5 deletions bandwidth.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ class Params(Structure):
]


get_bandwidth = CDLL("bandwidth.dylib").get_bandwidth
get_bandwidth.argtypes = [POINTER(Params)]


def human_rate(bytes):
i = 0
suffixes = ["B", "K", "M"]
Expand All @@ -27,11 +31,6 @@ def format_human(p: Params):
return f"{iface}{net_in}{net_out}"


get_bandwidth = CDLL("bandwidth.dylib").get_bandwidth
get_bandwidth.argtypes = [POINTER(Params)]


def retrieve(p: Params):
get_bandwidth(byref(p))
print(p.last_in, p.last_out, p.net_in, p.net_out, p.ifa_name)
return format_human(p)

0 comments on commit 35487a0

Please sign in to comment.