import requests


def get_episode_data(cfg, episode_id):
    """
    Requests episode information from Opencast.

    :param episode_id: Unique identifier for episode
    :param cfg: Opencast configuration
    :return: Tuple of episode title, parent seriesId and parent series title
    """
    url = cfg['uri'] + "/api/events/" + episode_id
    r = requests.get(url=url, auth=(cfg['user'], cfg['password']))
    x = r.json()
    return x['title'], x['is_part_of'], x['series']