Merge pull request #279 from jikan-me/fix/anime-sweeper

Fixes merging of IDs from mal-id-cache in indexers
This commit is contained in:
László GÖRÖG 2022-10-01 21:31:52 +02:00 committed by GitHub
commit 02107d9ebe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 6 deletions

View File

@ -19,7 +19,7 @@ class AnimeIndexer extends Command
*`
* @var string
*/
protected $signature = 'indexer:anime
protected $signature = 'indexer:anime
{--failed : Run only entries that failed to index last time}
{--resume : Resume from the last position}
{--reverse : Start from the end of the array}
@ -150,7 +150,7 @@ class AnimeIndexer extends Command
true
);
$this->ids = $ids['sfw'] + $ids['nsfw']; // merge
$ids = array_merge($ids['sfw'], $ids['nsfw']);
Storage::put('indexer/anime_mal_id.json', json_encode($this->ids));
return json_decode(Storage::get('indexer/anime_mal_id.json'));

View File

@ -61,10 +61,13 @@ class AnimeSweepIndexer extends Command
foreach ($results as $result) {
if (!array_key_exists($result['mal_id'], $malIds)) {
echo "Removing https://myanimelist.net/anime/".$result['mal_id']."\n";
$remove[] = $result['_id'];
}
}
echo "\n\n".count($remove);
echo "Delete removed MAL IDs\n";
DB::table('anime')->whereIn('_id', $remove)->delete();
}
@ -82,7 +85,7 @@ class AnimeSweepIndexer extends Command
true
);
$ids = $ids['sfw'] + $ids['nsfw']; // merge
$ids = array_merge($ids['sfw'], $ids['nsfw']);
Storage::put('indexer/anime_mal_id_sweep.json', json_encode($ids));
return json_decode(Storage::get('indexer/anime_mal_id_sweep.json'));

View File

@ -19,7 +19,7 @@ class MangaIndexer extends Command
*`
* @var string
*/
protected $signature = 'indexer:manga
protected $signature = 'indexer:manga
{--failed : Run only entries that failed to index last time}
{--resume : Resume from the last position}
{--reverse : Start from the end of the array}
@ -150,7 +150,7 @@ class MangaIndexer extends Command
true
);
$this->ids = $ids['sfw'] + $ids['nsfw']; // merge
$ids = array_merge($ids['sfw'], $ids['nsfw']);
Storage::put('indexer/manga_mal_id.json', json_encode($this->ids));
return json_decode(Storage::get('indexer/manga_mal_id.json'));

View File

@ -82,7 +82,7 @@ class MangaSweepIndexer extends Command
true
);
$ids = $ids['sfw'] + $ids['nsfw']; // merge
$ids = array_merge($ids['sfw'], $ids['nsfw']);
Storage::put('indexer/manga_mal_id_sweep.json', json_encode($ids));
return json_decode(Storage::get('indexer/manga_mal_id_sweep.json'));