My personal scoreboard for Rabona

avatar

Have been using my inky pHat as a mining dashboard for a while, and actually, it did help a lot in the last couple of months. I have plans to add more updaters so that I can get more information rotated on the screen.

The second updater is for Rabona. I play https://rabona.io on full auto-play (in a customized way) mode, but still, I was looking for quick ways to see the last match's score and the next match, so here we are:

foo.jpeg

Here is the script if you're curious. Requires rabona_python and inkyPhat libraries.


from datetime import datetime

import inkyphat
from rabona_python import RabonaClient

font_file = inkyphat.fonts.FredokaOne
font = inkyphat.ImageFont.truetype(font_file, 11)
inkyphat.set_colour('red')

USER = "emrebeyler"

def main():
    rc = RabonaClient()

    now_as_str = datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%S')
    next_match = rc.matches(
        user=USER, start_date=now_as_str, limit=1)["matches"][0]
    next_match_str = f"{next_match['club_1']} vs {next_match['club_2']}"

    last_match = \
    rc.matches(user=USER, end_date=now_as_str, limit=1, order="DESC")[
        "matches"][0]
    last_match_str = f"{last_match['club_1']} {last_match['goals_team_1']}:" \
                     f"{last_match['goals_team_2']} {last_match['club_2']}"

    last_match_header = "Last match"
    next_match_header = "Next match"
    print(last_match_str)
    print(next_match_str)

    w, h = font.getsize(last_match_header)
    msg_x = int((inkyphat.WIDTH - w) - 150)
    msg_y = int((inkyphat.HEIGHT - h) - 10)

    text_colour = inkyphat.BLACK
    inkyphat.text((msg_x, msg_y - 70), last_match_header.upper(), text_colour,
                  font=font)
    inkyphat.text((msg_x, msg_y - 50), last_match_str.upper(), text_colour,
                  font=font)
    inkyphat.text((msg_x, msg_y - 30), next_match_header.upper(), text_colour,
                  font=font)
    inkyphat.text((msg_x, msg_y - 10), next_match_str.upper(), text_colour,
                  font=font)
    inkyphat.set_rotation(180)
    inkyphat.show()

main()

Posted with STEMGeeks



0
0
0.000
11 comments
avatar

You having fun with those e-ink displays.
I still haven't messed with one, I want a 3 color one but larger than those tinyphats.

0
0
0.000
avatar

yeah, the amount of space is very limited on my e-ink display, I suggest a bigger one.

0
0
0.000
avatar

I bet @schlafhacking will love that.

0
0
0.000
avatar

yep, very nice! (Sorry for my non-involvement in the new game. It's probably aweseome, but my interest in football/soocer is basically not existing, so it's not you or the game but the subject of it :D )

0
0
0.000