Пример #1
0
 public function createCbr()
 {
     $chapterImageDir = $this->_mangaInfo->getOutputDir() . 'images/' . $this->_chapterInfo->getNumber() . '/';
     if (!is_dir($chapterImageDir)) {
         consoleLineError("Chapter image dir {$chapterImageDir} not found!");
         exit;
     }
     $cbrDirPath = $this->_mangaInfo->getCbrDirPath();
     if (!is_dir($cbrDirPath)) {
         consoleLineError("Cbr dir {$cbrDirPath} not found!");
         exit;
     }
     $cNum = $this->_chapterInfo->getNumber();
     $cTitle = $this->_chapterInfo->getTitle();
     $mSlug = $this->_mangaInfo->getSlug();
     $cbrFileName = '[' . $mSlug . '-' . str_pad($cNum, 6, '0', STR_PAD_LEFT) . '] - ' . Sanitization::stripNonwordCharachters($cTitle, '-', 'lower') . '.cbr';
     $shellCommand = "rar a \"{$cbrDirPath}{$cbrFileName}\" {$chapterImageDir}*.jpg";
     $this->_chapterInfo->setCbrFileName($cbrFileName);
     if ($this->shouldPrintRarOutput()) {
         consoleLineInfo(shell_exec($shellCommand));
     } else {
         shell_exec($shellCommand);
     }
     consoleLinePurple("Created CBR file: " . $cbrFileName);
     if (file_exists($cbrDirPath . $cbrFileName)) {
         //shell_exec("notify-send --hint int:transient:1 -u low -t 2000 \".cbr created\" \"CBR file {$cbrFileName} created!\"");
     }
 }
Пример #2
0
 /**
  * @param bool $original
  *
  * @return null
  */
 public function getNumber($original = false)
 {
     if ($original) {
         return trim($this->_number);
     } else {
         return Sanitization::stripNonwordCharachters(trim($this->_number));
     }
 }