예제 #1
0
 /**
  * Look for an .nfo file in the NZB, return the NFO message id.
  * Gets the NZB completion.
  * Looks for PAR2 files in the NZB.
  *
  * @param string $guid
  * @param string $relID
  * @param int    $groupID
  * @param string $groupName
  *
  * @return bool
  *
  * @access public
  */
 public function getNfoFromNZB($guid, $relID, $groupID, $groupName)
 {
     $fetchedBinary = false;
     $messageID = $this->parseNZB($guid, $relID, $groupID, true);
     if ($messageID !== false) {
         $fetchedBinary = $this->nntp->getMessages($groupName, $messageID['ID'], $this->alternateNNTP);
         if ($this->nntp->isError($fetchedBinary)) {
             // NFO download failed, increment attempts.
             $this->pdo->queryExec(sprintf('UPDATE releases SET nfostatus = nfostatus - 1 WHERE id = %d', $relID));
             if ($this->echooutput) {
                 echo 'f';
             }
             return false;
         }
         if ($this->nfo->isNFO($fetchedBinary, $guid) === true) {
             if ($this->echooutput) {
                 echo $messageID['hidden'] === false ? '+' : '*';
             }
         } else {
             if ($this->echooutput) {
                 echo '-';
             }
             $this->pdo->queryExec(sprintf('UPDATE releases SET nfostatus = %d WHERE id = %d', Nfo::NFO_NONFO, $relID));
             $fetchedBinary = false;
         }
     } else {
         if ($this->echooutput) {
             echo '-';
         }
         $this->pdo->queryExec(sprintf('UPDATE releases SET nfostatus = %d WHERE id = %d', Nfo::NFO_NONFO, $relID));
     }
     return $fetchedBinary;
 }
예제 #2
0
 /**
  * Verify a file is a NFO and add it to the database.
  *
  * @param string $fileLocation
  */
 protected function _processNfoFile($fileLocation)
 {
     $data = @file_get_contents($fileLocation);
     if ($data !== false) {
         if ($this->_nfo->isNFO($data, $this->_release['guid']) === true) {
             if ($this->_nfo->addAlternateNfo($data, $this->_release, $this->_nntp) === true) {
                 $this->_releaseHasNoNFO = false;
             }
         }
     }
 }