summaryrefslogtreecommitdiff
path: root/app/Anime.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Anime.php')
-rw-r--r--app/Anime.php31
1 files changed, 16 insertions, 15 deletions
diff --git a/app/Anime.php b/app/Anime.php
index 9e6ac58..5fd4db3 100644
--- a/app/Anime.php
+++ b/app/Anime.php
@@ -38,7 +38,7 @@ class Anime extends Model {
$jikan = new Malclient;
try {
- $this->animeInfo = $jikan->getAnime(
+ $animeInfo = $jikan->getAnime(
(new \Jikan\Request\Anime\AnimeRequest( $this->mal_id ))
);
} catch (\Exception $e) {
@@ -47,19 +47,24 @@ class Anime extends Model {
echo "\n\n";
}
- $this->url = $this->animeInfo->GetUrl();
- $this->image_url = $this->animeInfo->getImageUrl();
+ if ( strtolower("not yet aired") == strtolower($animeInfo->getStatus()) ) {
+ echo "Anime (" . $this->mal_id . ") has not aired yet. Skipping\n";
+ return;
+ }
+
+ $this->url = $animeInfo->GetUrl();
+ $this->image_url = $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 = $animeInfo->getTitleEnglish();
+ $this->title_rom = $animeInfo->getTitle();
+ $this->title_nat = $animeInfo->getTitleJapanese();
+ $this->title_pref = $animeInfo->getTitle();
- $this->anime_type = $this->animeInfo->getType();
- $this->broadcasted = $this->animeInfo->getBroadcast();
+ $this->anime_type = $animeInfo->getType();
+ $this->broadcasted = $animeInfo->getBroadcast();
- $this->episodes = $this->animeInfo->getEpisodes();
- $this->is_airing = $this->animeInfo->isAiring();
+ $this->episodes = $animeInfo->getEpisodes();
+ $this->is_airing = $animeInfo->isAiring();
}
public function getStats() {
@@ -70,10 +75,6 @@ class Anime extends Model {
return $this->hasMany('App\Airing', 'mal_id', 'mal_id');
}
- protected function getInfo() {
- return $this->animeInfo;
- }
-
public function user() {
return $this->belongsToMany('App\MALUser', 'is_watching', 'mal_id', 'user_id')
->as('anime')