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!\""); } }
public function dumpChapterTitles() { $allChapters = MangaStatus::getInstance()->getAllChaptersList(); $csvPath = $this->_mangaInfo->getOutputDir() . 'chapter-titles.' . $this->_mangaInfo->getSource() . '.' . date('Y-m-d_H-i') . '.csv'; $f = fopen($csvPath, 'w'); if ($f) { /** * @var ChapterInfo $c */ foreach ($allChapters as $c) { fputcsv($f, array($c->getNumber(), $c->getTitle())); } fclose($f); consoleLinePurple("Titles exported to " . $csvPath); } else { consoleLineError("Unable to create file " . $csvPath); exit; } }