Skip to content

Commit

Permalink
Work around missing titles in Orthocal API
Browse files Browse the repository at this point in the history
  • Loading branch information
chadwhitacre committed Feb 20, 2024
1 parent d709dc9 commit 7e20b8a
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,23 @@ class BadHeadings(RuntimeError):
# Heavy lifting
# =============

# Work around https://github.com/brianglass/orthocal-python/issues/54.
OVERRIDES = {
-76: 'Monday after Zacchaeus Sunday',
-75: 'Tuesday after Zacchaeus Sunday',
-74: 'Wedneseday after Zacchaeus Sunday',
-73: 'Thursday after Zacchaeus Sunday',
-72: 'Friday after Zacchaeus Sunday',
-71: 'Saturday after Zacchaeus Sunday',

-69: 'Monday before Great Lent',
-68: 'Tuesday before Great Lent',
-67: 'Wedneseday before Great Lent',
-66: 'Thursday before Great Lent',
-65: 'Friday before Great Lent',
-64: 'Saturday before Great Lent',
}


@alru_cache(maxsize=3)
async def fetch(y, m, d):
Expand All @@ -52,7 +69,7 @@ async def fetch(y, m, d):
body = "There is no Gospel reading for today."
ref = ""
else:
heading = day["titles"][0]
heading = OVERRIDES.get(day["pdist"], day["titles"][0])
body = ""
ref = gospel["display"].replace(".", ":")

Expand Down

0 comments on commit 7e20b8a

Please sign in to comment.