From 675109d7344a222de5cf8bb843b1f7ec2942b69f Mon Sep 17 00:00:00 2001 From: horus Date: Thu, 23 Jul 2020 17:15:11 +0200 Subject: Bugfix. Correctly detects airing anime. --- app/Libraries/Background.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'app/Libraries') diff --git a/app/Libraries/Background.php b/app/Libraries/Background.php index 920c866..db9e42f 100644 --- a/app/Libraries/Background.php +++ b/app/Libraries/Background.php @@ -182,7 +182,7 @@ class Background { public function checkIfIsAiring() { $jikan = new Malclient; - foreach( Anime::where('is_airing', true)->get() as $anime) { + foreach( Anime::where('airing_status', '=', 4)->get() as $anime) { try { $animeInfo = $jikan->getAnime( (new \Jikan\Request\Anime\AnimeRequest( $anime->mal_id )) @@ -191,14 +191,18 @@ class Background { echo "checkIfIsAiring: Problem requesting AnimeInfo for (" . $anime->mal_id . ") continue\n"; echo $e->getMessage(); echo "\n\n"; + sleep(10); continue; } + + $airing_status = getAiringStatusCode( $animeInfo->getStatus() ); if ( ! $animeInfo->isAiring() ) { DB::table('anime') ->where('mal_id', $anime->mal_id) - ->update(['is_airing' => false]); + ->update(['is_airing' => false, 'airing_status' => $airing_status]); } + sleep(10); } } -- cgit v1.2.3