$reldata = $releases->searchAudio(isset($_GET["artist"]) ? $_GET["artist"] : "", isset($_GET["album"]) ? $_GET["album"] : "", isset($_GET["label"]) ? $_GET["label"] : "", isset($_GET["track"]) ? $_GET["track"] : "", isset($_GET["year"]) ? $_GET["year"] : "", $genreId, $offset, $limit, $categoryId, $maxage); $page->smarty->assign('offset', $offset); $page->smarty->assign('releases', $reldata); $output = trim($page->smarty->fetch('apiresult.tpl')); printOutput($relData, $outputXML, $page, $offset); break; // Search movie releases. // Search movie releases. case 'm': verifyEmptyParameter('q'); verifyEmptyParameter('imdbid'); $maxAge = maxAge(); $page->users->addApiRequest($uid, $_SERVER['REQUEST_URI'], $hosthash); $offset = offset(); $imdbId = isset($_GET['imdbid']) ? $_GET['imdbid'] : '-1'; $relData = $releases->searchbyImdbId($imdbId, $offset, limit(), isset($_GET['q']) ? $_GET['q'] : '', categoryid(), $maxAge); addCoverURL($relData, function ($release) { return Utility::getCoverURL(['type' => 'movies', 'id' => $release['imdbid']]); }); addLanguage($relData, $page->settings); printOutput($relData, $outputXML, $page, $offset); break; // Get NZB. // Get NZB. case 'g': if (!isset($_GET['id'])) { showApiError(200, 'Missing parameter (id is required for downloading an NZB)'); } $relData = $releases->getByGuid($_GET['id']); if ($relData) { header('Location:' . WWW_TOP . '/getnzb?i=' . $uid . '&r=' . $apiKey . '&id=' . $relData['guid'] . (isset($_GET['del']) && $_GET['del'] == '1' ? '&del=1' : ''));
showApiError(200); } $genre = ""; if (isset($_GET["genre"])) { $genre = $_GET["genre"]; } $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->searchbyImdbId(isset($_GET["imdbid"]) ? $_GET["imdbid"] : "-1", $offset, $limit, isset($_GET["q"]) ? $_GET["q"] : "", $categoryId, $genre, $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 music releases //
$maxAge = maxAge(); $page->users->addApiRequest($uid, $_SERVER['REQUEST_URI']); $offset = offset(); $relData = $releases->searchbyRageId(isset($_GET['rid']) ? $_GET['rid'] : '-1', isset($_GET['season']) ? $_GET['season'] : '', isset($_GET['ep']) ? $_GET['ep'] : '', $offset, limit(), isset($_GET['q']) ? $_GET['q'] : '', categoryID(), $maxAge); addLanguage($relData, $page->settings); printOutput($relData, $outputXML, $page, $offset); break; // Search movie releases. // Search movie releases. case 'm': verifyEmptyParameter('q'); verifyEmptyParameter('imdbid'); $maxAge = maxAge(); $page->users->addApiRequest($uid, $_SERVER['REQUEST_URI']); $offset = offset(); $relData = $releases->searchbyImdbId(isset($_GET['imdbid']) ? $_GET['imdbid'] : '-1', $offset, limit(), isset($_GET['q']) ? $_GET['q'] : '', categoryID(), $maxAge); addLanguage($relData, $page->settings); printOutput($relData, $outputXML, $page, $offset); break; // Get NZB. // Get NZB. case 'g': if (!isset($_GET['id'])) { showApiError(200, 'Missing parameter (id is required for downloading an NZB)'); } $relData = $releases->getByGuid($_GET['id']); if ($relData) { header('Location:' . WWW_TOP . '/getnzb?i=' . $uid . '&r=' . $apiKey . '&id=' . $relData['guid'] . (isset($_GET['del']) && $_GET['del'] == '1' ? '&del=1' : '')); } else { showApiError(300, 'No such item (the guid you provided has no release in our database)'); }