summaryrefslogtreecommitdiff
path: root/app/Anime.php
diff options
context:
space:
mode:
authorhorus2020-03-05 22:24:28 +0100
committerhorus2020-03-05 22:24:36 +0100
commit38ad5415db862e24da03ee194ef723540f9848a6 (patch)
tree2f9a5bf2f53029bc21c338d9ef865638d69c8454 /app/Anime.php
parent095aba3e990afe5b181524e4830dc4d85e9475be (diff)
downloadsenpai-38ad5415db862e24da03ee194ef723540f9848a6.tar.gz
Basic usage implemented.
Diffstat (limited to 'app/Anime.php')
-rw-r--r--app/Anime.php34
1 files changed, 20 insertions, 14 deletions
diff --git a/app/Anime.php b/app/Anime.php
index 7971430..9e6ac58 100644
--- a/app/Anime.php
+++ b/app/Anime.php
@@ -25,35 +25,41 @@ class Anime extends Model {
'title_pref',
'anime_type',
'broadcasted',
- 'episodes'
+ 'episodes',
+ 'is_airing'
];
public function __construct() {
}
- public function fill( $id, $parse_info = true ) {
+ public function fill( $id ) {
$this->mal_id = $id;
- if ( $parse_info ) {
- $jikan = new Malclient;
+ $jikan = new Malclient;
+ try {
$this->animeInfo = $jikan->getAnime(
(new \Jikan\Request\Anime\AnimeRequest( $this->mal_id ))
);
+ } catch (\Exception $e) {
+ echo "Problem requesting AnimeInfo for (" . $anime->mal_id . ") continue\n";
+ echo $e->getMessage();
+ echo "\n\n";
+ }
- $this->url = $this->animeInfo->GetUrl();
- $this->image_url = $this->animeInfo->getImageUrl();
+ $this->url = $this->animeInfo->GetUrl();
+ $this->image_url = $this->animeInfo->getImageUrl();
- $this->title_eng = $this->animeInfo->getTitleEnglish();
- $this->title_rom = $this->animeInfo->getTitle();
- $this->title_nat = $this->animeInfo->getTitleJapanese();
- $this->title_pref = $this->animeInfo->getTitle();
+ $this->title_eng = $this->animeInfo->getTitleEnglish();
+ $this->title_rom = $this->animeInfo->getTitle();
+ $this->title_nat = $this->animeInfo->getTitleJapanese();
+ $this->title_pref = $this->animeInfo->getTitle();
- $this->anime_type = $this->animeInfo->getType();
- $this->broadcasted = $this->animeInfo->getBroadcast();
+ $this->anime_type = $this->animeInfo->getType();
+ $this->broadcasted = $this->animeInfo->getBroadcast();
- $this->episodes = $this->animeInfo->getEpisodes();
- }
+ $this->episodes = $this->animeInfo->getEpisodes();
+ $this->is_airing = $this->animeInfo->isAiring();
}
public function getStats() {