From 11f9e412546c5c2ca9d5a4200a327a653c943e85 Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Tue, 17 Jan 2017 12:47:02 -0500 Subject: [PATCH] Update commands --- src/Command/CacheImages.php | 116 ------------------------------------ src/Command/ClearCache.php | 2 +- 2 files changed, 1 insertion(+), 117 deletions(-) delete mode 100644 src/Command/CacheImages.php diff --git a/src/Command/CacheImages.php b/src/Command/CacheImages.php deleted file mode 100644 index 5f9df74f..00000000 --- a/src/Command/CacheImages.php +++ /dev/null @@ -1,116 +0,0 @@ - - * @copyright 2015 - 2017 Timothy J. Warren - * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @version 4.0 - * @link https://github.com/timw4mail/HummingBirdAnimeClient - */ - -namespace Aviat\AnimeClient\Command; - -use Aviat\AnimeClient\Util; - -/** - * Generates thumbnail image cache so that cover images load faster - */ -class CacheImages extends BaseCommand { - - /** - * Manga Model - * - * @var Aviat\AnimeClient\Model\Manga - */ - protected $mangaModel; - - /** - * Anime Model - * - * @var Aviat\AnimeClient\Model\Anime - */ - protected $animeModel; - - /** - * Miscellaneous helper methods - * - * @var Aviat\AnimeClient\Util - */ - protected $util; - - /** - * Convert manga images - * - * @throws \ConsoleKit\ConsoleException - * @return void - */ - protected function getMangaImages() - { - $raw_list = $this->mangaModel->_get_list_from_api(); - $manga_list = array_column($raw_list, 'manga'); - - $total = count($raw_list); - $current = 0; - foreach($manga_list as $item) - { - $this->util->get_cached_image($item['poster_image'], $item['id'], 'manga'); - $current++; - - echo "Cached {$current} of {$total} manga images. \n"; - } - } - - /** - * Convert anime images - * - * @throws \ConsoleKit\ConsoleException - * @return void - */ - protected function getAnimeImages() - { - $raw_list = $this->animeModel->get_raw_list(); - - $total = count($raw_list); - $current = 0; - foreach($raw_list as $item) - { - $this->util->get_cached_image($item['anime']['cover_image'], $item['anime']['slug'], 'anime'); - $current++; - - echo "Cached {$current} of {$total} anime images. \n"; - } - } - - /** - * Run the image conversion script - * - * @param array $args - * @param array $options - * @return void - * @throws \ConsoleKit\ConsoleException - */ - public function execute(array $args, array $options = []) - { - $this->setContainer($this->setupContainer()); - $this->util = new Util($this->container); - $this->animeModel = $this->container->get('anime-model'); - $this->mangaModel = $this->container->get('manga-model'); - - $this->echoBox('Starting image conversion'); - - $this->echoBox('Converting manga images'); - $this->getMangaImages(); - - $this->echoBox('Converting anime images'); - $this->getAnimeImages(); - - $this->echoBox('Finished image conversion'); - } -} -// End of CacheImages.php \ No newline at end of file diff --git a/src/Command/ClearCache.php b/src/Command/ClearCache.php index d47bc0ba..2e58019d 100644 --- a/src/Command/ClearCache.php +++ b/src/Command/ClearCache.php @@ -32,7 +32,7 @@ class ClearCache extends BaseCommand { { $this->setContainer($this->setupContainer()); $cache = $this->container->get('cache'); - $cache->purge(); + $cache->clear(); $this->echoBox('API Cache has been cleared.'); }