Skip to content

Commit 82b794f

Browse files
committed
Add date and time for upcoming livestreams (closes #19)
1 parent 4e55b88 commit 82b794f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/srgssr.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,16 @@ def build_entry_apiv3(self, data, is_show=False, whitelist_ids=None):
654654
urn = data['urn']
655655
self.log(f'build_entry_apiv3: urn = {urn}')
656656
title = utils.try_get(data, 'title')
657+
658+
# Add the date & time to the title for upcoming livestreams:
659+
if utils.try_get(data, 'type') == 'SCHEDULED_LIVESTREAM':
660+
dt = utils.try_get(data, 'date')
661+
if dt:
662+
dt = utils.parse_datetime(dt)
663+
if dt:
664+
dts = dt.strftime('(%d.%m.%Y, %H:%M)')
665+
title = dts + ' ' + title
666+
657667
media_id = utils.try_get(data, 'id')
658668
if whitelist_ids is not None and media_id not in whitelist_ids:
659669
return

0 commit comments

Comments
 (0)