$seriesimg[] = $r['imgdata']; $seriesid[] = $r['id']; } } $rage = array('releasetitle' => array_shift($seriesnames), 'description' => array_shift($seriesdescription), 'country' => array_shift($seriescountry), 'genre' => array_shift($seriesgenre), 'imgdata' => array_shift($seriesimg), 'id' => array_shift($seriesid)); } } if ($data['anidbid'] > 0) { $AniDB = new AniDB(['Settings' => $releases->pdo]); $ani = $AniDB->getAnimeInfo($data['anidbid']); } if ($data['imdbid'] != '' && $data['imdbid'] != 00) { $movie = new Movie(['Settings' => $page->settings]); $mov = $movie->getMovieInfo($data['imdbid']); $trakt = new TraktTv(['Settings' => $page->settings]); $traktSummary = $trakt->traktMoviesummary('tt' . $data['imdbid'], true); if ($traktSummary !== false && isset($traktSummary['trailer']) && $traktSummary['trailer'] !== '' && preg_match('/[\\/?]v[\\/\\=](\\w+)$/i', $traktSummary['trailer'], $youtubeM)) { $mov['trailer'] = '<embed width="480" height="345" src="' . 'https://www.youtube.com/v/' . $youtubeM[1] . '" type="application/x-shockwave-flash"></embed>'; } else { $mov['trailer'] = nzedb\utility\imdb_trailers($data['imdbid']); } if ($mov && isset($mov['title'])) { $mov['title'] = str_replace(array('/', '\\'), '', $mov['title']); $mov['actors'] = $movie->makeFieldLinks($mov, 'actors'); $mov['genre'] = $movie->makeFieldLinks($mov, 'genre'); $mov['director'] = $movie->makeFieldLinks($mov, 'director'); } else { if ($traktSummary !== false) { $mov['title'] = str_replace(array('/', '\\'), '', $traktSummary['title']); } else { $mov = false;
/** * Process releases with no IMDB ID's. * * @param string $groupID (Optional) ID of a group to work on. * @param string $guidChar (Optional) First letter of a release GUID to use to get work. * @param int $lookupIMDB (Optional) 0 Don't lookup IMDB, 1 lookup IMDB, 2 lookup IMDB on releases that were renamed. */ public function processMovieReleases($groupID = '', $guidChar = '', $lookupIMDB = 1) { if ($lookupIMDB == 0) { return; } $trakTv = new TraktTv(['Settings' => $this->pdo]); // Get all releases without an IMDB id. $res = $this->pdo->query(sprintf("\n\t\t\t\tSELECT r.searchname, r.id\n\t\t\t\tFROM releases r\n\t\t\t\tWHERE r.imdbid IS NULL\n\t\t\t\tAND r.nzbstatus = 1\n\t\t\t\tAND r.categoryid BETWEEN 2000 AND 2999\n\t\t\t\t%s %s %s\n\t\t\t\tLIMIT %d", $groupID === '' ? '' : 'AND r.group_id = ' . $groupID, $guidChar === '' ? '' : 'AND r.guid ' . $this->pdo->likeString($guidChar, false, true), $lookupIMDB == 2 ? 'AND r.isrenamed = 1' : '', $this->movieqty)); $movieCount = count($res); if ($movieCount > 0) { if ($this->echooutput && $movieCount > 1) { $this->pdo->log->doEcho($this->pdo->log->header("Processing " . $movieCount . " movie releases.")); } // Loop over releases. foreach ($res as $arr) { // Try to get a name/year. if ($this->parseMovieSearchName($arr['searchname']) === false) { //We didn't find a name, so set to all 0's so we don't parse again. $this->pdo->queryExec(sprintf("UPDATE releases SET imdbid = 0000000 WHERE id = %d", $arr["id"])); continue; } else { $this->currentRelID = $arr['id']; $movieName = $this->currentTitle; if ($this->currentYear !== false) { $movieName .= ' (' . $this->currentYear . ')'; } if ($this->echooutput) { $this->pdo->log->doEcho($this->pdo->log->primaryOver("Looking up: ") . $this->pdo->log->headerOver($movieName), true); } // Check local DB. $getIMDBid = $this->localIMDBsearch(); if ($getIMDBid !== false) { $imdbID = $this->doMovieUpdate('tt' . $getIMDBid, 'Local DB', $arr['id']); if ($imdbID !== false) { continue; } } // Check OMDB api. $buffer = nzedb\utility\getUrl('http://www.omdbapi.com/?t=' . urlencode($this->currentTitle) . ($this->currentYear !== false ? '&y=' . $this->currentYear : '') . '&r=json'); if ($buffer !== false) { $getIMDBid = json_decode($buffer); if (isset($getIMDBid->imdbID)) { $imdbID = $this->doMovieUpdate($getIMDBid->imdbID, 'OMDbAPI', $arr['id']); if ($imdbID !== false) { continue; } } } // Check on trakt. $getIMDBid = $trakTv->traktMoviesummary($movieName); if ($getIMDBid !== false) { $imdbID = $this->doMovieUpdate($getIMDBid, 'Trakt', $arr['id']); if ($imdbID !== false) { continue; } } // Try on search engines. if ($this->searchEngines && $this->currentYear !== false) { if ($this->imdbIDFromEngines() === true) { continue; } } // We failed to get an IMDB id from all sources. $this->pdo->queryExec(sprintf("UPDATE releases SET imdbid = 0000000 WHERE id = %d", $arr["id"])); } } } }