Exemple #1
0
 /**
  * @param string $message
  * @param bool   $reset
  */
 public function overWriteHeader($message, $reset = False)
 {
     if ($reset) {
         $this->lastMessageLength = 0;
     }
     echo str_repeat(chr(8), $this->lastMessageLength);
     echo str_repeat(" ", $this->lastMessageLength);
     echo str_repeat(chr(8), $this->lastMessageLength);
     $this->lastMessageLength = strlen($message);
     echo $this->cli->headerOver($message);
 }
Exemple #2
0
 /**
  * Work out the category based on the name, resets to null if no category matched.
  */
 private function determineCategory($rel, &$foundName, &$methodused)
 {
     $categoryID = null;
     $category = new Categorize();
     $categoryID = $category->determineCategory($rel['groupname'], $foundName);
     if ($methodused == 'a.b.hdtv.x264' && $rel['groupname'] == 'alt.binaries.hdtv.x264') {
         $categoryID = Category::CAT_MOVIE_HD;
     }
     if ($categoryID == $rel['categoryid'] || $categoryID == '7900' || ($foundName == $rel['name'] || $foundName == $rel['searchname'])) {
         $foundName = null;
         $methodused = null;
     } else {
         $foundName = str_replace(''', '', trim(html_entity_decode($foundName)));
         $name = str_replace(' ', '_', $foundName);
         $searchname = str_replace('_', ' ', $foundName);
         echo PHP_EOL . ColorCLI::headerOver('ReleaseID: 		') . ColorCLI::primaryOver($rel['rid']) . PHP_EOL . ColorCLI::headerOver(' Group: 		') . ColorCLI::primaryOver($rel['groupname']) . PHP_EOL . ColorCLI::headerOver(' Old Name: 		') . ColorCLI::primaryOver($rel['name']) . PHP_EOL . ColorCLI::headerOver(' Old SearchName: 	') . ColorCLI::primaryOver($rel['searchname']) . PHP_EOL . ColorCLI::headerOver(' New Name: 		') . ColorCLI::primaryOver($name) . PHP_EOL . ColorCLI::headerOver(' New SearchName: 	') . ColorCLI::primaryOver($searchname) . PHP_EOL . ColorCLI::headerOver(' Old Cat: 		') . ColorCLI::primaryOver($rel['categoryid']) . PHP_EOL . ColorCLI::headerOver(' New Cat: 		') . ColorCLI::primaryOver($categoryID) . PHP_EOL . ColorCLI::headerOver(' Method: 		') . ColorCLI::primaryOver($methodused) . PHP_EOL;
         if (!$this->echoonly) {
             $this->pdo->queryExec(sprintf("update releases SET name = %s, searchname = %s, categoryid = %d, imdbid = NULL, rageid = -1, bookinfoid = NULL, musicinfoid = NULL, consoleinfoid = NULL WHERE releases.id = %d", $this->pdo->escapeString($name), $this->pdo->escapeString($searchname), $categoryID, $rel['rid']));
         }
         $this->numupdated++;
     }
 }
Exemple #3
0
 /**
  * Echo a updated release name to CLI.
  *
  * @param array $data
  *        array(
  *              'new_name'     => (string) The new release search name.
  *              'old_name'     => (string) The old release search name.
  *              'new_category' => (string) The new category name or id for the release.
  *              'old_category' => (string) The old category name or id for the release.
  *              'group'        => (string) The group name or id of the release.
  *              'release_id'   => (int)    The id of the release.
  *              'method'       => (string) The method used to rename the release.
  *        )
  *
  * @access public
  * @static
  * @void
  */
 public static function echoChangedReleaseName(array $data = array('new_name' => '', 'old_name' => '', 'new_category' => '', 'old_category' => '', 'group' => '', 'release_id' => 0, 'method' => ''))
 {
     echo PHP_EOL . ColorCLI::headerOver('New name:     ') . ColorCLI::primaryOver($data['new_name']) . PHP_EOL . ColorCLI::headerOver('Old name:     ') . ColorCLI::primaryOver($data['old_name']) . PHP_EOL . ColorCLI::headerOver('New category: ') . ColorCLI::primaryOver($data['new_category']) . PHP_EOL . ColorCLI::headerOver('Old category: ') . ColorCLI::primaryOver($data['old_category']) . PHP_EOL . ColorCLI::headerOver('Group:        ') . ColorCLI::primaryOver($data['group']) . PHP_EOL . ColorCLI::headerOver('Release id:   ') . ColorCLI::primaryOver($data['release_id']) . PHP_EOL . ColorCLI::headerOver('Method:       ') . ColorCLI::primaryOver($data['method']) . PHP_EOL;
 }