if (isset($_GET["season"]) && $_GET["season"] == "") {
     showApiError(200);
 }
 if (isset($_GET["ep"]) && $_GET["ep"] == "") {
     showApiError(200);
 }
 $users->addApiRequest($uid, $_SERVER['REQUEST_URI'], $hosthash);
 $limit = 100;
 if (isset($_GET["limit"]) && is_numeric($_GET["limit"]) && $_GET["limit"] < 100) {
     $limit = $_GET["limit"];
 }
 $offset = 0;
 if (isset($_GET["offset"]) && is_numeric($_GET["offset"])) {
     $offset = $_GET["offset"];
 }
 $reldata = $releases->searchbyTVId(isset($_GET["rid"]) ? $_GET["rid"] : "-1", isset($_GET["tvdbid"]) ? $_GET["tvdbid"] : "-1", isset($_GET["tvmazeid"]) ? $_GET["tvmazeid"] : "-1", isset($_GET["season"]) ? $_GET["season"] : "", isset($_GET["ep"]) ? $_GET["ep"] : "", $offset, $limit, isset($_GET["q"]) ? $_GET["q"] : "", $categoryId, $maxage);
 $page->smarty->assign('offset', $offset);
 $page->smarty->assign('releases', $reldata);
 $page->smarty->assign('rsshead', $page->smarty->fetch('rssheader.tpl'));
 $output = trim($page->smarty->fetch('apiresult.tpl'));
 if ($outputtype == "xml") {
     header("Content-type: text/xml");
     echo $output;
 } else {
     header('Content-type: application/json');
     echo json_encode(responseXmlToObject($output));
 }
 break;
 //
 // search movie releases
 //