<?php session_start(); if (!isset($_SESSION['admin_user_id']) || !$_SESSION['admin_user_id']) { exit; } set_time_limit(0); @extract($_POST); @extract($_GET); require_once "../../vars.php"; require_once "../../includes/show.class.php"; require_once "../../includes/sidereel.class.php"; $show = new Show(); $sidereel = new Sidereel(); $thisshow = $show->getShow($showid, true, "en"); $title = $sidereel->sidereelURL($thisshow[$showid]['title'], $thisshow[$showid]['sidereel_url']); $link = "http://www.sidereel.com/{$title}/season-{$season}/episode-{$episode}"; $details = $sidereel->getEpisodeDetails($link); if (@$details['title'] || @$details['description']) { $t = $details['title']; if (!$t) { $t = "Season {$season}, Episode {$episode}"; } $description = $details['description']; if (substr_count(strtolower($t), "season") == 0 && substr_count(strtolower($t), "episode") == 0) { $t = "Season {$season}, Episode {$episode} - {$t}"; } $ret = array(); $ret['title'] = str_replace('"', '', $t); $ret['description'] = $description; print json_encode($ret);
$episode_id = $episode_data['id']; } else { // new episode require_once "../includes/sidereel.class.php"; $sidereel = new Sidereel(); $episode_data = array(); $episode_data['show_id'] = $link_data['show_id']; $episode_data['season'] = $link_data['season']; $episode_data['episode'] = $link_data['episode']; if (isset($global_languages['en'])) { $show_data = $show->getShow($link_data['show_id'], false, "en"); } else { $show_data = $show->getShow($link_data['show_id'], false, $default_language); } // title and description $sidereel_title = $sidereel->sidereelURL($show_data['title'], $show_data['sidereel_url']); $sidereel_link = "http://www.sidereel.com/" . $sidereel_title . "/season-" . $link_data['season'] . "/episode-" . $link_data['episode']; $episode_details = $sidereel->getEpisodeDetails($sidereel_link); if (isset($episode_details['title']) && $episode_details['title']) { if (substr_count(strtolower($episode_details['title']), "season") == 0 && substr_count(strtolower($episode_details['title']), "episode") == 0) { $episode_details['title'] = "Season " . $link_data['season'] . ", Episode " . $link_data['episode'] . " - " . $episode_details['title']; } $episode_data['title'] = $episode_details['title']; } else { $episode_data['title'] = "Season " . $link_data['season'] . ", Episode " . $link_data['episode']; } if (isset($episode_details['description']) && $episode_details['description']) { $episode_data['description'] = $episode_details['description']; } else { $episode_data['description'] = "No description"; }