Skip to content

Commit

Permalink
Adds date and time to game, updates gif render
Browse files Browse the repository at this point in the history
  • Loading branch information
theimpossibleleap committed Dec 7, 2024
1 parent 4e5c304 commit 1883436
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Binary file modified apps/vgknextgame/vgk_next_game.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 14 additions & 3 deletions apps/vgknextgame/vgk_next_game.star
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ timestamp = time.now().format("2006-01-02")

vgkNextGameWeek = "https://api-web.nhle.com/v1/club-schedule/VGK/week/" + timestamp

def convertTime(utcTimestamp):
t = time.parse_time(utcTimestamp)
pst = t.in_location("US/Pacific")
pst.format("2006-01-02T15:04:05Z07:00")

return pst.format("3:04PM")

def main():
response = http.get(vgkNextGameWeek.format(ttl_seconds = 3600))

Expand All @@ -24,13 +31,16 @@ def main():

if len(d["games"]) == 0:
nextStartDate = "> 1 week"
nextStartTime = ""
nextHomeTeam = ""
nextAwayTeam = ""
at = "Go Knights"
else:
nextStartDate = d["games"][0]["gameDate"]
nextStartTime = convertTime(d["games"][0]["startTimeUTC"])

nextStartDate = nextStartDate.split("-")
year = nextStartDate.pop(0)
year = nextStartDate.pop(0)[2:4]
nextStartDate.append(year)
nextStartDate = "-".join(nextStartDate)

Expand All @@ -52,9 +62,10 @@ def main():
render.Box(
child = render.Column(
children = [
render.Text(content = "NEXT GAME:", font = "tom-thumb", color = "B4975A"),
render.Text(content = "NEXT GAME:", font = "tom-thumb", color = "C8102E"),
render.Text(content = "" + nextAwayTeam + at + nextHomeTeam, font = "tom-thumb", color = "B4975A"),
render.Text(content = "" + nextStartDate, font = "tom-thumb"),
render.Text(content = "" + nextAwayTeam + at + nextHomeTeam, font = "tom-thumb"),
render.Text(content = "" + nextStartTime, font = "tom-thumb"),
],
),
),
Expand Down

0 comments on commit 1883436

Please sign in to comment.