Skip to content

Commit

Permalink
Lauds: Support the summer/winter Lauds hymns
Browse files Browse the repository at this point in the history
  • Loading branch information
gregordick committed Jan 25, 2025
1 parent dd62ea7 commit 1e1b9ec
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 16 deletions.
9 changes: 7 additions & 2 deletions scripts/bringup/bringup-datagen.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,14 @@ def make_out_key(key, do_basename):
part = ('capitulum' if do_basename.endswith('Major Special')
else 'antiphonae')
out_key = f'psalterium/{util.day_ids[day]}/ad-{hour}/{part}'
elif re.match(r'Hymnus Day\d Vespera$', key):
elif re.match(r'Hymnus Day(\d) (Laudes\d?|Vespera)$', key):
day = int(key[10])
out_key = 'psalterium/%s/ad-vesperas/hymnus' % (util.day_ids[day],)
hour = 'ad-laudes' if 'Laudes' in key else 'ad-vesperas'
base = 'psalterium'
if key.endswith('Day0 Laudes'):
# As opposed to Day0 Laudes2.
base += '/in-aestate'
out_key = f'{base}/{util.day_ids[day]}/{hour}/hymnus'
elif key == 'Quad Vespera':
out_key = 'proprium/de-tempore/quadragesima/in-feriis/ad-vesperas/capitulum'
elif key == 'Hymnus Quad Vespera':
Expand Down
22 changes: 16 additions & 6 deletions src/officium/calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,10 +696,14 @@ def offices(self, date):

# Get seasonal keys, which in practice means the months from August to
# November. These are strictly weekly, so only for Sundays do we have
# first Vespers.
reading_day = self.reading_day_str(date + 1 if date.day_of_week == 6
else date)
season_keys = [reading_day] if reading_day else []
# first Vespers. TODO: This won't work for Matins, and is wrong in
# principle for Lauds.
reading_date = date + 1 if date.day_of_week == 6 else date
reading_day = self.reading_day(reading_date)
if reading_day is not None:
season_keys = [self.reading_day_str(reading_date)]
else:
season_keys = []

lauds_offices = [today[0]]
vespers_offices = [office]
Expand All @@ -724,12 +728,18 @@ def offices(self, date):
for (vc, ofc) in zip(vespers_classeses, vespers_offices)
]

seasons = [season]
if 5 <= date.month <= 7 or (reading_day is not None and
reading_day[1] <= 9):
# Invent a season to allow for the summer Matins and Lauds parts.
seasons.append('in-aestate')

return OrderedDict([
('lauds', [cls(date, self._data_map, self._index, self, season,
('lauds', [cls(date, self._data_map, self._index, self, seasons,
season_keys, doxology, lauds_office, today[1:])
for (cls, lauds_office) in zip(lauds_classes,
lauds_offices)]),
('vespers', [cls(date, self._data_map, self._index, self, season,
('vespers', [cls(date, self._data_map, self._index, self, seasons,
season_keys, doxology, vespers_office, today,
concurring,
self.vespers_commem_filter(commemorations, date,
Expand Down
17 changes: 9 additions & 8 deletions src/officium/vespers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ class LaudsAndVespers(ABC):
default_psalmish_class = parts.PsalmishWithGloria
preces_key = 'ordinarium/ad-vesperas/preces-feriales'

def __init__(self, date, generic_data, index, calendar_resolver, season,
def __init__(self, date, generic_data, index, calendar_resolver, seasons,
season_keys, doxology, office, commemorations):
self._date = date
self._generic_data = generic_data
self._index = index
self._calendar_resolver = calendar_resolver
self._season = season
self._seasons = seasons
self._season_keys = season_keys
self._office = office
self._commemorations = list(commemorations)
Expand Down Expand Up @@ -64,8 +64,9 @@ def lookup_order(self, office, items, use_commons=True):
for keys in [office.keys] + ([['%s/commune' % (key,)
for key in office.keys]]
if use_commons else []):
if self._season:
paths += ['%s/%s' % (key, self._season) for key in keys]
if self._seasons:
paths += ['%s/%s' % (key, season)
for key in keys for season in self._seasons]
paths += list(keys)

season = [
Expand All @@ -88,8 +89,8 @@ def lookup_order(self, office, items, use_commons=True):
paths.append('proprium/%s' % (sunday,))

psalter_prefixes = []
if self._season:
psalter_prefixes.append('/' + self._season)
if self._seasons:
psalter_prefixes.extend('/' + season for season in self._seasons)
psalter_prefixes.append('')
for prefix in psalter_prefixes:
paths += [
Expand Down Expand Up @@ -268,10 +269,10 @@ def resolve(self):


class Vespers(LaudsAndVespers):
def __init__(self, date, generic_data, index, calendar_resolver, season,
def __init__(self, date, generic_data, index, calendar_resolver, seasons,
season_keys, doxology, office, morning_offices, concurring,
commemorations):
super().__init__(date, generic_data, index, calendar_resolver, season,
super().__init__(date, generic_data, index, calendar_resolver, seasons,
season_keys, doxology, office, commemorations)

# These are the offices that were said this morning at Lauds, and not
Expand Down

0 comments on commit 1e1b9ec

Please sign in to comment.