Skip to content

Commit

Permalink
improve text message
Browse files Browse the repository at this point in the history
  • Loading branch information
xss committed Jan 28, 2022
1 parent 6ef76b9 commit 84e6232
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion poster.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 84e6232

Please sign in to comment.