Example #1
0
Enjoy the talk,  
The Virtual Science Forum team
""")

if __name__ == "__main__":
    logger = logging.getLogger()
    logger.setLevel(logging.INFO)
    common.wait_until(45)
    now = datetime.datetime.now(tz=pytz.UTC)
    exceptions = common.CollectExceptions()

    with exceptions:
        rotate_meetings()

    talks, _ = common.talks_data()
    talks = [talk for talk in talks if talk["event_type"] == "speakers_corner"]
    logging.info(f"Loaded {len(talks)} talks.")
    for talk in talks:
        talk["time"] = talk["time"].replace(tzinfo=pytz.UTC)

    with exceptions:
        # Remind about a talk starting in 2 hours.
        upcoming_talk = next(
            (
                talk for talk in talks
                if (talk["time"] - now).total_seconds() // 3600 == 2
            ),
            None
        )
        if upcoming_talk is not None:
Example #2
0
            talk["registration_url"] = registration_url
            # Add this talk to researchseminars.org
            # publish_to_researchseminars(talk)
            # Email the author
            notify_author(talk, join_url)

            num_updated += 1

    return num_updated


if __name__ == "__main__":
    # Get a handle on the repository
    target_branch = "master"
    repo = common.vsf_repo()
    talks, sha = common.talks_data(repo=repo)
    yaml = common.yaml

    # If we added Zoom links, we should update the file in the repo
    if (num_updated := schedule_talks(repo, talks)):
        commit_message = f"add Zoom link{'s' * (num_updated > 1)} for {num_updated} talks"
        serialized = StringIO()
        yaml.dump(talks, serialized)

        repo.update_file(
            common.TALKS_FILE,
            commit_message,
            serialized.getvalue(),
            sha=sha,
            branch=target_branch,
        )
import os

from common import talks_data
from schedulezoomtalks import notify_author

if __name__ == "__main__":
    talks, _ = talks_data()
    issue_number = int(os.getenv("ISSUE_NUMBER"))
    notify_author(
        next(talk for talk in talks if talk["workflow_issue"] == issue_number))
Example #4
0
                                        to + "@mail.virtualscienceforum.org",
                                        "subject": header["subject"],
                                        "text": common.markdown_to_plain(body),
                                        "html": common.markdown_to_email(body),
                                    })
    else:
        try:
            key, value = "zoom_meeting_id", int(to)
        except ValueError:
            if not to.startswith("#"):
                issue.create_comment(
                    "I couldn't parse to whom to send the email :(")
                return
            key, value = "workflow_issue", int(to[1:])
        # We are sending an email to zoom meeting participants
        talks, _ = common.talks_data(repo=repo)
        try:
            talk = next(talk for talk in talks if talk.get(key) == value)
        except StopIteration:
            if key == "workflow_issue":
                issue.create_comment(
                    "I couldn't parse to whom to send the email :(")
                return

            # Not a tracked talk, no extra data associated.
            talk = {"zoom_meeting_id": value}

        body += MEETING_MESSAGE_FOOTER(talk["zoom_meeting_id"])

        response = common.send_to_participants(
            template=jinja2.Template(body),