예제 #1
0
 /**
  * Cleans a usenet subject returning a string that can be used to "merge" files together, a pretty subject, a categoryID and the name status.
  *
  * @param string $subject   Subject to parse.
  * @param string $groupName Group to work in.
  *
  * @return string
  */
 public function collectionsCleaner($subject, $groupName)
 {
     $this->subject = $subject;
     $this->groupName = $groupName;
     // Try DB regex first.
     $potentialString = $this->_regexes->tryRegex($subject, $groupName);
     if ($potentialString) {
         return $potentialString;
     }
     switch ($groupName) {
         /*
         case 'alt.binaries.this.is.an.example':
         	return $this->_example_method_name();
         */
         case null:
         default:
             return $this->generic();
     }
 }
예제 #2
0
 public function releaseCleaner($subject, $fromName, $size, $groupName, $usepre = false)
 {
     $match = $matches = [];
     $this->groupName = $groupName;
     $this->subject = $subject;
     $this->fromName = $fromName;
     $this->size = $size;
     // Get pre style name from releases.name
     if (preg_match_all('/([\\w\\(\\)]+[\\s\\._-]([\\w\\(\\)]+[\\s\\._-])+[\\w\\(\\)]+-\\w+)/', $this->subject, $matches)) {
         foreach ($matches as $match) {
             foreach ($match as $val) {
                 $title = $this->pdo->queryOneRow("SELECT title, id from predb WHERE title = " . $this->pdo->escapeString(trim($val)));
                 // don't match against ab.teevee if title is for just the season
                 if ($this->groupName == 'alt.binaries.teevee' and preg_match('/\\.S\\d\\d\\./', $title['title'], $match)) {
                     $title = false;
                 }
                 if ($title !== false) {
                     return ["cleansubject" => $title['title'], "properlynamed" => true, "increment" => false, "predb" => $title['id'], "requestid" => false];
                 }
             }
         }
     }
     // Get pre style name from requestid
     if (preg_match('/^\\[ ?(\\d{4,6}) ?\\]/', $this->subject, $match) || preg_match('/^REQ\\s*(\\d{4,6})/i', $this->subject, $match) || preg_match('/^(\\d{4,6})-\\d{1}\\[/', $this->subject, $match) || preg_match('/(\\d{4,6}) -/', $this->subject, $match)) {
         $title = $this->pdo->queryOneRow(sprintf('SELECT p.title , p.id from predb p INNER JOIN groups g on g.id = p.group_id WHERE p.requestid = %d and g.name = %s', $match[1], $this->pdo->escapeString($this->groupName)));
         //check for predb title matches against other groups where it matches relative size / fromname
         //known crossposted requests only atm
         $reqGname = '';
         switch ($this->groupName) {
             case 'alt.binaries.etc':
                 if ($this->fromName === 'kingofpr0n (brian@iamking.ws)') {
                     $reqGname = 'alt.binaries.teevee';
                 }
                 break;
             case 'alt.binaries.mom':
                 if ($this->fromName === 'Yenc@power-post.org (Yenc-PP-A&A)' || $this->fromName === 'yEncBin@Poster.com (yEncBin)') {
                     $reqGname = 'alt.binaries.moovee';
                 }
                 break;
             case 'alt.binaries.hdtv.x264':
                 if ($this->fromName === 'moovee@4u.tv (moovee)') {
                     $reqGname = 'alt.binaries.moovee';
                 }
                 break;
         }
         if ($title === false && !empty($reqGname)) {
             $title = $this->pdo->queryOneRow(sprintf("SELECT p.title as title, p.id as id from predb p INNER JOIN groups g on g.id = p.group_id\n\t\t\t\t\t\t\t\tWHERE p.requestid = %d and g.name = %s", $match[1], $this->pdo->escapeString($reqGname)));
         }
         // don't match against ab.teevee if title is for just the season
         if ($this->groupName == 'alt.binaries.teevee' and preg_match('/\\.S\\d\\d\\./', $title['title'], $match)) {
             $title = false;
         }
         if ($title !== false) {
             return ["cleansubject" => $title['title'], "properlynamed" => true, "increment" => false, "predb" => $title['id'], "requestid" => true];
         }
     }
     if ($usepre === true) {
         return false;
     }
     // Try DB regex.
     $potentialName = $this->_regexes->tryRegex($subject, $groupName);
     if ($potentialName) {
         return $potentialName;
     }
     //if www.town.ag releases check against generic_town regexes
     if (preg_match('/www\\.town\\.ag/i', $this->subject)) {
         return $this->generic_town();
     }
     switch ($groupName) {
         case 'alt.binaries.teevee':
             return $this->teevee();
         default:
             return $this->generic();
     }
 }