summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorhorus2020-09-23 16:42:17 +0200
committerhorus2020-09-23 16:42:17 +0200
commitb2f1970612d3312eac35f3a2854d40d44a680073 (patch)
treeb368e8702c6921668c854b16da666f9d68ed391d /app
parent6f4c8f0630b6cb094566f9102f7c8cfd8be36239 (diff)
downloadsenpai-b2f1970612d3312eac35f3a2854d40d44a680073.tar.gz
bugfix
Diffstat (limited to 'app')
-rw-r--r--app/Anime.php9
-rw-r--r--app/helpers.php2
2 files changed, 6 insertions, 5 deletions
diff --git a/app/Anime.php b/app/Anime.php
index 81fdee3..4999c1b 100644
--- a/app/Anime.php
+++ b/app/Anime.php
@@ -34,7 +34,7 @@ class Anime extends Model {
public function __construct() {
}
- public function fill( $id ) {
+ public function fill( $id, $skip_if_unpopular = true ) {
$this->mal_id = $id;
$jikan = new Malclient;
@@ -49,7 +49,7 @@ class Anime extends Model {
echo "\n\n";
}
- if ( 10000 > $animeInfo->getMembers() ) {
+ if ( $skip_if_unpopular && 10000 > $animeInfo->getMembers() ) {
echo "Anime (" . $this->mal_id . ") has only " . $animeInfo->getMembers() . " Members. Not worth to keep. Skipping\n";
return;
}
@@ -76,6 +76,7 @@ class Anime extends Model {
$this->airing_status = getAiringStatusCode($animeInfo->getStatus());
+
if ( is_null($animeInfo->getPremiered()) ) {
if ( env('ANIME_NOT_YET_AIRED') != $this->airing_status ) {
$tmp_date = getSeasonFromDate( $animeInfo->getAired()->getFrom() );
@@ -84,8 +85,8 @@ class Anime extends Model {
$this->season_year = $tmp_date["year"];
}
} else {
- $this->season_name = explode(" ", $this->getPremiered())[0];
- $this->season_year = explode(" ", $this->getPremiered())[1];
+ $this->season_name = explode(" ", $animeInfo->getPremiered())[0];
+ $this->season_year = explode(" ", $animeInfo->getPremiered())[1];
}
}
diff --git a/app/helpers.php b/app/helpers.php
index c2c6b16..c5a227c 100644
--- a/app/helpers.php
+++ b/app/helpers.php
@@ -125,7 +125,7 @@ function compare($str1, $str2) {
}
function getSeasonFromDate($aired_at) {
- if ( is_null($ared_at) ) {
+ if ( is_null($aired_at) ) {
return array("name" => null, "year" => null);
}