grab and display mastodon notifications

workspace
Brendan Howell 6 years ago
parent 457d856816
commit 6da9b8a54f

@ -292,6 +292,8 @@ class PublicRelations(Bureau):
prn.codepage = "cp437" prn.codepage = "cp437"
# TODO: add fancier formatting i.e. inverted text for username/handle # TODO: add fancier formatting i.e. inverted text for username/handle
# TODO: clean this up to use the built in formatting from escpos lib
# and make a print_status function to use for notifications too
toots = self.masto.timeline(limit=count) toots = self.masto.timeline(limit=count)
out = "" out = ""
for t in toots: for t in toots:
@ -324,8 +326,16 @@ class PublicRelations(Bureau):
tw_shortcode = self.short_tweet_id(str(t["id"])) tw_shortcode = self.short_tweet_id(str(t["id"]))
prn.barcode("PRmad." + tw_shortcode, "CODE128", function_type="B") prn.barcode("PRmad." + tw_shortcode, "CODE128", function_type="B")
prn.text("\r\n\r\n")
notifications = self.masto.notifications()
if len(notifications) > 0:
prn.set(text_type="B")
prn.text("NOTIFICATIONS:\r\n")
for note in notifications:
prn.text(note["type"] + " " + note["created_at"] + " from " +
note["account"] + ":\r\n" + note["status"] + "\r\n")
prn.text("\r\n\r\n")
prn.cut() prn.cut()

Loading…
Cancel
Save