Ejemplo n.º 1
0
 /**
  * @param array $options Echo to cli / Class instances.
  */
 public function __construct(array $options = [])
 {
     $defaults = ['Echo' => false, 'ReleaseImage' => null, 'Settings' => null];
     $options += $defaults;
     $this->pdo = $options['Settings'] instanceof Settings ? $options['Settings'] : new Settings();
     $this->releaseImage = $options['ReleaseImage'] instanceof ReleaseImage ? $options['ReleaseImage'] : new ReleaseImage($this->pdo);
     $this->movieqty = $this->pdo->getSetting('maxxxxprocessed') != '' ? $this->pdo->getSetting('maxxxxprocessed') : 100;
     $this->showPasswords = Releases::showPasswords($this->pdo);
     $this->debug = NN_DEBUG;
     $this->echooutput = $options['Echo'] && NN_ECHOCLI;
     $this->imgSavePath = NN_COVERS . 'xxx' . DS;
     $this->cookie = NN_TMP . 'xxx.cookie';
     if (NN_DEBUG || NN_LOGGING) {
         $this->debug = true;
         try {
             $this->debugging = new \Logger();
         } catch (\LoggerException $error) {
             $this->_debug = false;
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * @param array $options Class instances / Echo to CLI.
  */
 public function __construct(array $options = [])
 {
     $defaults = ['Echo' => false, 'Logger' => null, 'ReleaseImage' => null, 'Settings' => null, 'TMDb' => null];
     $options += $defaults;
     $this->pdo = $options['Settings'] instanceof Settings ? $options['Settings'] : new Settings();
     $this->releaseImage = $options['ReleaseImage'] instanceof \ReleaseImage ? $options['ReleaseImage'] : new \ReleaseImage($this->pdo);
     $this->lookuplanguage = $this->pdo->getSetting('lookuplanguage') != '' ? (string) $this->pdo->getSetting('lookuplanguage') : 'en';
     $this->fanartapikey = $this->pdo->getSetting('fanarttvkey');
     $this->imdburl = $this->pdo->getSetting('imdburl') == 0 ? false : true;
     $this->movieqty = $this->pdo->getSetting('maximdbprocessed') != '' ? $this->pdo->getSetting('maximdbprocessed') : 100;
     $this->searchEngines = true;
     $this->showPasswords = Releases::showPasswords($this->pdo);
     $this->debug = NN_DEBUG;
     $this->echooutput = $options['Echo'] && NN_ECHOCLI && $this->pdo->cli;
     $this->imgSavePath = NN_COVERS . 'movies' . DS;
     $this->service = '';
     if (NN_DEBUG || NN_LOGGING) {
         $this->debug = true;
         try {
             $this->debugging = new \Logger();
         } catch (\LoggerException $error) {
             $this->_debug = false;
         }
     }
 }
Ejemplo n.º 3
0
 public function getGamesRange($cat, $start, $num, $orderby, $maxage = -1, $excludedcats = array())
 {
     $browseby = $this->getBrowseBy();
     if ($start === false) {
         $limit = "";
     } else {
         $limit = " LIMIT " . $num . " OFFSET " . $start;
     }
     $catsrch = '';
     if (count($cat) > 0 && $cat[0] != -1) {
         $catsrch = (new \Category(['Settings' => $this->pdo]))->getCategorySearch($cat);
     }
     if ($maxage > 0) {
         $maxage = sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxage);
     } else {
         $maxage = '';
     }
     $exccatlist = "";
     if (count($excludedcats) > 0) {
         $exccatlist = " AND r.categoryid NOT IN (" . implode(",", $excludedcats) . ")";
     }
     $order = $this->getGamesOrder($orderby);
     return $this->pdo->query(sprintf("SELECT GROUP_CONCAT(r.id ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_id, " . "GROUP_CONCAT(r.rarinnerfilecount ORDER BY r.postdate DESC SEPARATOR ',') as grp_rarinnerfilecount, " . "GROUP_CONCAT(r.haspreview ORDER BY r.postdate DESC SEPARATOR ',') AS grp_haspreview, " . "GROUP_CONCAT(r.passwordstatus ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_password, " . "GROUP_CONCAT(r.guid ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_guid, " . "GROUP_CONCAT(rn.id ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_nfoid, " . "GROUP_CONCAT(groups.name ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_grpname, " . "GROUP_CONCAT(r.searchname ORDER BY r.postdate DESC SEPARATOR '#') AS grp_release_name, " . "GROUP_CONCAT(r.postdate ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_postdate, " . "GROUP_CONCAT(r.size ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_size, " . "GROUP_CONCAT(r.totalpart ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_totalparts, " . "GROUP_CONCAT(r.comments ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_comments, " . "GROUP_CONCAT(r.grabs ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_grabs, " . "con.*, YEAR (con.releasedate) as year, r.gamesinfo_id, groups.name AS group_name,\n\t\t\t\trn.id as nfoid FROM releases r " . "LEFT OUTER JOIN groups ON groups.id = r.groupid " . "LEFT OUTER JOIN releasenfo rn ON rn.releaseid = r.id " . "INNER JOIN gamesinfo con ON con.id = r.gamesinfo_id " . "WHERE r.nzbstatus = 1 AND con.title != '' AND " . "r.passwordstatus %s AND %s %s %s %s " . "GROUP BY con.id ORDER BY %s %s" . $limit, Releases::showPasswords($this->pdo), $browseby, $catsrch, $maxage, $exccatlist, $order[0], $order[1]), true, NN_CACHE_EXPIRY_MEDIUM);
 }
Ejemplo n.º 4
0
 public function getBookRange($cat, $start, $num, $orderby, $excludedcats = [])
 {
     $browseby = $this->getBrowseBy();
     if ($start === false) {
         $limit = '';
     } else {
         $limit = ' LIMIT ' . $num . ' OFFSET ' . $start;
     }
     $catsrch = '';
     if (count($cat) > 0 && $cat[0] != -1) {
         $catsrch = (new \Category(['Settings' => $this->pdo]))->getCategorySearch($cat);
     }
     $maxage = '';
     if ($maxage > 0) {
         $maxage = sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxage);
     }
     $exccatlist = '';
     if (count($excludedcats) > 0) {
         $exccatlist = ' AND r.categoryid NOT IN (' . implode(',', $excludedcats) . ')';
     }
     $order = $this->getBookOrder($orderby);
     $sql = sprintf("SELECT GROUP_CONCAT(r.id ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_id, " . "GROUP_CONCAT(r.rarinnerfilecount ORDER BY r.postdate DESC SEPARATOR ',') as grp_rarinnerfilecount, " . "GROUP_CONCAT(r.haspreview ORDER BY r.postdate DESC SEPARATOR ',') AS grp_haspreview, " . "GROUP_CONCAT(r.passwordstatus ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_password, " . "GROUP_CONCAT(r.guid ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_guid, " . "GROUP_CONCAT(rn.id ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_nfoid, " . "GROUP_CONCAT(groups.name ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_grpname, " . "GROUP_CONCAT(r.searchname ORDER BY r.postdate DESC SEPARATOR '#') AS grp_release_name, " . "GROUP_CONCAT(r.postdate ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_postdate, " . "GROUP_CONCAT(r.size ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_size, " . "GROUP_CONCAT(r.totalpart ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_totalparts, " . "GROUP_CONCAT(r.comments ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_comments, " . "GROUP_CONCAT(r.grabs ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_grabs, " . "GROUP_CONCAT(r.failed ORDER BY r.postdate DESC SEPARATOR ',') AS grp_release_failed," . "boo.*, r.bookinfoid, groups.name AS group_name, rn.id as nfoid FROM releases r " . "LEFT OUTER JOIN groups ON groups.id = r.groupid " . "LEFT OUTER JOIN releasenfo rn ON rn.releaseid = r.id " . "INNER JOIN bookinfo boo ON boo.id = r.bookinfoid " . "WHERE r.nzbstatus = 1 AND boo.cover = 1 AND boo.title != '' AND " . "r.passwordstatus %s AND %s %s %s %s " . "GROUP BY boo.id ORDER BY %s %s" . $limit, Releases::showPasswords($this->pdo), $browseby, $catsrch, $maxage, $exccatlist, $order[0], $order[1]);
     return $this->pdo->query($sql, true, NN_CACHE_EXPIRY_MEDIUM);
 }