# Register your receivers here from django.dispatch import receiver from pretalx.agenda.recording import BaseRecordingProvider from pretalx.agenda.signals import register_recording_provider from pretalx.cfp.signals import html_head from pretalx.submission.models import Submission class MatomoVideoProvider(BaseRecordingProvider): """ a bit of a hack to add buttons linking to livestream and chat to the details page """ def get_recording(self, submission: Submission): is_past_submission = submission.event.id in {1, 4} # 1: 2021, 4: 2022 is_workshop = submission.submission_type.id == 2 button_title = "View Workshop" if is_workshop else "View Livestream" livestream_url = f"https://live.matomocamp.org/" + submission.code chat_url = livestream_url + "/chat_room" recording_url = livestream_url + "/recording" recording_embed_url = livestream_url + "/recording_embed" if is_past_submission: return { "iframe": f"""
View Recording Join Chatroom
""", "csp_header": "https://video.matomocamp.org/ https://live.matomocamp.org/" } else: return { "iframe": f"""
{button_title} Join Chatroom
""", } @receiver(register_recording_provider) def matomo_video_provider(sender, **kwargs): return MatomoVideoProvider(sender) @receiver(html_head) def append_to_header(sender, **kwargs): return ""