From 84e6232a0644e7d630917fbf0d0405d3ed3eda55 Mon Sep 17 00:00:00 2001 From: xss Date: Sat, 29 Jan 2022 07:41:32 +1100 Subject: [PATCH] improve text message --- poster.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/poster.py b/poster.py index 36676d3..53f5583 100644 --- a/poster.py +++ b/poster.py @@ -31,7 +31,11 @@ def on_created(event): print(f"new Image: {event.src_path}") time.sleep(2) media = mastodon.media_post(event.src_path, "image/png") - mastodon.status_post('SSTV Image received:', media_ids=[media["id"]]) + sstv_mode, date, time = event.src_path.split("/")[-1].split("_") + date = event.src_path.split("/")[-1].split("_")[1] + date = f"{date[:4]}-{date[4:6]}-{date[6:]}" + time = f"{time[:2]}:{time[2:4]}:{time[4:6]}" + mastodon.status_post(f"SSTV {sstv_mode} Image received on {int(os.environ['FREQ'])/1000000:.3f} MHz {os.environ['MODE']} at {date} {time} UTC\n#sstv #{sstv_mode} #{int(os.environ['FREQ'])/1000:.0f}", media_ids=[media["id"]]) os.remove(event.src_path) except: print(traceback.format_exc())