From 07c46827111c0e4e6bee490f53557fcdbebd5280 Mon Sep 17 00:00:00 2001 From: Timothy J Warren Date: Mon, 16 Jan 2017 14:03:30 -0500 Subject: [PATCH] Update views for collection, remove old json import --- app/views/collection/cover.php | 2 +- app/views/collection/list.php | 2 +- src/Model/AnimeCollection.php | 55 +--------------------------------- 3 files changed, 3 insertions(+), 56 deletions(-) diff --git a/app/views/collection/cover.php b/app/views/collection/cover.php index 26280031..919b2d54 100644 --- a/app/views/collection/cover.php +++ b/app/views/collection/cover.php @@ -15,7 +15,7 @@
- ({$item['alternate_title']})" : ""; ?> +
{$item['alternate_title']}" : ""; ?>
diff --git a/app/views/collection/list.php b/app/views/collection/list.php index 77f61bca..61840d5f 100644 --- a/app/views/collection/list.php +++ b/app/views/collection/list.php @@ -34,7 +34,7 @@ - + " . $item['alternate_title'] . "" : "" ?> diff --git a/src/Model/AnimeCollection.php b/src/Model/AnimeCollection.php index 822d20e0..da8e989a 100644 --- a/src/Model/AnimeCollection.php +++ b/src/Model/AnimeCollection.php @@ -26,19 +26,6 @@ use PDO; */ class AnimeCollection extends Collection { - /** - * Constructor - * - * @param ContainerInterface $container - */ - public function __construct(ContainerInterface $container) - { - parent::__construct($container); - - // Do an import if an import file exists - // $this->json_import(); - } - /** * Get collection from the database, and organize by media type * @@ -138,7 +125,7 @@ class AnimeCollection extends Collection { $this->db->set([ 'hummingbird_id' => $data['id'], 'slug' => $anime->slug, - 'title' => $anime->title, + 'title' => array_shift($anime->titles), 'alternate_title' => implode('
', $anime->titles), 'show_type' => $anime->show_type, 'age_rating' => $anime->age_rating, @@ -210,46 +197,6 @@ class AnimeCollection extends Collection { return $query->fetch(PDO::FETCH_ASSOC); } - /** - * Import anime into collection from a json file - * - * @return void - */ - private function json_import() - { - if ( ! file_exists('import.json') OR ! $this->valid_database) - { - return; - } - - $anime = Json::decodeFile("import.json"); - - foreach ($anime as $item) - { - $util = $this->container->get('util'); - - $this->db->set([ - 'hummingbird_id' => $item->id, - 'slug' => $item->slug, - 'title' => $item->title, - 'alternate_title' => $item->alternate_title, - 'show_type' => $item->show_type, - 'age_rating' => $item->age_rating, - 'cover_image' => basename( - $util->get_cached_image($item->cover_image, $item->slug, 'anime') - ), - 'episode_count' => $item->episode_count, - 'episode_length' => $item->episode_length - ])->insert('anime_set'); - } - - // Delete the import file - unlink('import.json'); - - // Update genre info - $this->update_genres(); - } - /** * Update genre information for selected anime *