function fetchPlayEpisode($host, $link)
{
    $template = new KinotoSeriesTemplate();
    //Recover info and set to template
    $template->setMovieTitle($_SESSION["serieTitle"]);
    $template->setImage($_SESSION["serieImage"]);
    $template->setDescription($_SESSION["serieDescription"]);
    $content = file_get_contents($link, false, getExplorerContext(getSiteHash()));
    switch ($host) {
        case "Megavideo.com":
            addMegavideoLink($template, $content);
            break;
        case "Bitload.com (Flash)":
            addBitloadLink($template, $content);
            break;
        case "Bitload.com (DivX)":
            addBitloadDivxLink($template, $content);
            break;
        case "Various (Flash)":
            addNovamovLink($template, $content);
            break;
        case "Archiv.to (Flash)":
            addArchivToFlash($template, $content);
            break;
        case "Archiv.to (DivX)":
            addArchivToDivx($template, $content);
            break;
    }
    $template->generateView(KinotoSeriesTemplate::VIEW_PLAY, $_SESSION["serieTitle"]);
}
            addMegavideoLink($template, $url);
            break;
        case "Bitload.com (Flash)":
            addBitloadLink($template, $url);
            break;
        case "Bitload.com (DivX)":
            addBitloadDivxLink($template, $url);
            break;
        case "Various (Flash)":
            addNovamovLink($template, $url);
            break;
        case "Archiv.to (Flash)":
            addArchivToFlash($template, $url);
            break;
        case "Archiv.to (DivX)":
            addArchivToDivx($template, $url);
            break;
    }
    $template->generateView(KinotoTemplate::VIEW_PLAY);
}
function addMegavideoLink($template, $url)
{
    // ADD  &PartNo=1
    $content = file_get_contents($url, false, getExplorerContext(getSiteHash()));
    $content = str_replace("\\", "", $content);
    //Get movie files
    preg_match_all("/PartNo=(.*)\"/U", $content, $parts, PREG_SET_ORDER);
    if ($parts) {
        foreach ($parts as $part) {
            $content = file_get_contents($url . "&PartNo=" . $part[1], false, getExplorerContext(getSiteHash()));
            $content = str_replace("\\", "", $content);