include filesize in notification

This commit is contained in:
ed 2023-01-31 19:03:13 +00:00
parent 712a578e6c
commit 2f15bb5085

View file

@ -26,9 +26,23 @@ parameters explained,
""" """
try:
from copyparty.util import humansize
except:
def humansize(n):
return n
def main(): def main():
dp, fn = os.path.split(sys.argv[1]) fp = sys.argv[1]
msg = "🏷️ {}\n📁 {}".format(fn, dp) dp, fn = os.path.split(fp)
try:
sz = humansize(os.path.getsize(fp))
except:
sz = "?"
msg = "{} ({})\n📁 {}".format(fn, sz, dp)
title = "File received" title = "File received"
if "com.termux" in sys.executable: if "com.termux" in sys.executable: