Example #1
0
 /**
  * @param int    $imDbId
  * @param int    $offset
  * @param int    $limit
  * @param string $name
  * @param array  $cat
  * @param int    $maxAge
  *
  * @return array
  */
 public function searchbyImdbId($imDbId, $offset = 0, $limit = 100, $name = '', $cat = [-1], $maxAge = -1)
 {
     $whereSql = sprintf("%s\n\t\t\tWHERE r.categoryid BETWEEN 2000 AND 2999\n\t\t\tAND r.nzbstatus = %d\n\t\t\tAND r.passwordstatus %s\n\t\t\t%s %s %s %s", $name !== '' ? $this->releaseSearch->getFullTextJoinString() : '', NZB::NZB_ADDED, $this->showPasswords, $name !== '' ? $this->releaseSearch->getSearchSQL(['searchname' => $name]) : '', $imDbId != '-1' && is_numeric($imDbId) ? sprintf(' AND imdbid = %d ', str_pad($imDbId, 7, '0', STR_PAD_LEFT)) : '', $this->categorySQL($cat), $maxAge > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxAge) : '');
     $baseSql = sprintf("SELECT r.*,\n\t\t\t\tconcat(cp.title, ' > ', c.title) AS category_name,\n\t\t\t\t%s AS category_ids,\n\t\t\t\tg.name AS group_name,\n\t\t\t\trn.releaseid AS nfoid\n\t\t\tFROM releases r\n\t\t\tINNER JOIN groups g ON g.id = r.group_id\n\t\t\tINNER JOIN category c ON c.id = r.categoryid\n\t\t\tLEFT OUTER JOIN release_nfos rn ON rn.releaseid = r.id\n\t\t\tINNER JOIN category cp ON cp.id = c.parentid\n\t\t\t%s", $this->getConcatenatedCategoryIDs(), $whereSql);
     $sql = sprintf("%s\n\t\t\tORDER BY postdate DESC\n\t\t\tLIMIT %d OFFSET %d", $baseSql, $limit, $offset);
     $releases = $this->pdo->query($sql, true, nZEDb_CACHE_EXPIRY_MEDIUM);
     return $releases;
 }
Example #2
0
 /**
  * Remove releases that contain .wmv files and Codec\Setup.exe files, aka that spam poster.
  * Thanks to dizant from nZEDb forums for parts of the sql query
  *
  * @return string|boolean
  */
 protected function removeCodecPoster()
 {
     $this->method = 'Codec Poster';
     $regex = "rf.name REGEXP 'x264.*\\.(wmv|avi)\$'";
     $regex2 = "rf.name REGEXP '\\\\.*((DVDrip|BRRip)[. ].*[. ](R[56]|HQ)|720p[ .](DVDrip|HQ)|" . "Webrip.*[. ](R[56]|Xvid|AC3|US)|720p.*[. ]WEB-DL[. ]Xvid[. ]AC3[. ]US|" . "HDRip.*[. ]Xvid[. ]DD5).*[. ]avi\$'";
     $codec = '\\Codec%Setup.exe';
     $codec2 = '\\Codec%Installer.exe';
     $iferror = 'If_you_get_error.txt';
     $ifnotplaying = 'read me if the movie not playing.txt';
     $frenchv = 'Lisez moi si le film ne demarre pas.txt';
     $nl = 'lees me als de film niet spelen.txt';
     $german = 'Lesen Sie mir wenn der Film nicht abgespielt.txt';
     $german2 = 'Lesen Sie mir, wenn der Film nicht starten.txt';
     $categories = sprintf("r.categoryid IN (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)", Category::CAT_MOVIE_3D, Category::CAT_MOVIE_BLURAY, Category::CAT_MOVIE_DVD, Category::CAT_MOVIE_FOREIGN, Category::CAT_MOVIE_HD, Category::CAT_MOVIE_OTHER, Category::CAT_MOVIE_SD, Category::CAT_XXX_WMV, Category::CAT_XXX_X264, Category::CAT_XXX_XVID, Category::CAT_XXX_OTHER);
     switch (nZEDb_RELEASE_SEARCH_TYPE) {
         case ReleaseSearch::SPHINX:
             $rs = new ReleaseSearch($this->pdo);
             $codecFT1 = str_replace('=10000;', '=1000000;', $rs->getSearchSQL(['filename' => 'x264|wmv|avi|DVDrip|BRRip|R5|R6|HQ|Webrip|Xvid|AC3|HDRip|DD5']));
             $codecFT2 = str_replace('=10000;', '=1000000;', $rs->getSearchSQL(['filename' => 'Codec|error|txt|installer|vlc']));
             $ftJoin = $rs->getFullTextJoinString();
             break;
         default:
             $codecFT1 = $codecFT2 = $ftJoin = '';
             break;
     }
     $codeclike = sprintf("\n\t\t\t\tSELECT r.guid, r.searchname, r.id FROM releases r %s\n\t\t\t\tSTRAIGHT_JOIN release_files rf ON r.id = rf.releaseid\n\t\t\t\tWHERE %s %s AND\n\t\t\t\t\t(rf.name %s OR rf.name %s OR\n\t\t\t\t\trf.name %s OR rf.name %s OR\n\t\t\t\t\trf.name %s OR rf.name %s OR\n\t\t\t\t\trf.name %s OR rf.name %s)\n\t\t\t\t%s", $ftJoin, $categories, $codecFT2, $this->pdo->likeString($codec, true, true), $this->pdo->likeString($codec2, true, true), $this->pdo->likeString($iferror, true, true), $this->pdo->likeString($ifnotplaying, true, true), $this->pdo->likeString($frenchv, true, true), $this->pdo->likeString($nl, true, true), $this->pdo->likeString($german, true, true), $this->pdo->likeString($german2, true, true), $this->crapTime);
     $this->query = sprintf("SELECT r.guid, r.searchname, r.id FROM releases r %s\n\t\t\tSTRAIGHT_JOIN release_files rf ON (r.id = rf.releaseid)\n\t\t\tWHERE %s %s\n\t\t\tAND (%s OR %s) %s\n\t\t\tUNION %s", $ftJoin, $categories, $codecFT1, $regex, $regex2, $this->crapTime, $codeclike);
     if ($this->checkSelectQuery() === false) {
         return $this->returnError();
     }
     return $this->deleteReleases();
 }
Example #3
0
 /**
  * Remove releases with a scr file in the filename/subject.
  *
  * @return boolean|string
  */
 protected function removeSCR()
 {
     $this->method = '.scr';
     switch (nZEDb_RELEASE_SEARCH_TYPE) {
         case ReleaseSearch::SPHINX:
             $rs = new ReleaseSearch($this->pdo);
             $scrFT = str_replace('=10000;', '=10000000;', $rs->getSearchSQL(['(name,filename)' => 'scr']));
             $ftJoin = $rs->getFullTextJoinString();
             break;
         default:
             $scrFT = $ftJoin = '';
             break;
     }
     $this->query = sprintf("SELECT r.guid, r.searchname, r.id\n\t\t\tFROM releases r %s\n\t\t\tSTRAIGHT_JOIN release_files rf ON r.id = rf.releaseid\n\t\t\tWHERE (rf.name REGEXP '[.]scr[\$ \"]' OR r.name REGEXP '[.]scr[\$ \"]')\n\t\t\t%s %s", $ftJoin, $scrFT, $this->crapTime);
     if ($this->checkSelectQuery() === false) {
         return $this->returnError();
     }
     return $this->deleteReleases();
 }