Add command to check Kitsu's MAL id mappings

This commit is contained in:
Timothy Warren 2018-10-05 14:40:30 -04:00
parent 789af166ae
commit 0102a0b3ee
2 changed files with 4 additions and 16 deletions

View File

@ -23,7 +23,7 @@
"aura/router": "^3.0",
"aura/session": "^2.0",
"aviat/banker": "^1.0.0",
"aviat/ion": "^2.3.0",
"aviat/ion": "^2.4.1",
"ext-json": "*",
"ext-gd":"*",
"ext-pdo": "*",
@ -32,7 +32,7 @@
"psr/http-message": "~1.0",
"psr/log": "~1.0",
"yosymfony/toml": "^1.0",
"zendframework/zend-diactoros": "^1.3"
"zendframework/zend-diactoros": "^2.0.0"
},
"require-dev": {
"consolidation/robo": "~1.0",
@ -43,7 +43,7 @@
"phpstan/phpstan": "^0.9.1",
"phpunit/phpunit": "^6.0",
"roave/security-advisories": "dev-master",
"robmorgan/phinx": "^0.9.1",
"robmorgan/phinx": "^0.10.6",
"sebastian/phpcpd": "^3.0",
"spatie/phpunit-snapshot-assertions": "^1.2.0",
"squizlabs/php_codesniffer": "^3.2.2",

View File

@ -16,7 +16,6 @@
namespace Aviat\AnimeClient\Command;
use const Aviat\AnimeClient\MILLI_FROM_NANO;
use const Aviat\AnimeClient\SRC_DIR;
use function Amp\Promise\wait;
@ -158,8 +157,6 @@ final class MALIDCheck extends BaseCommand {
if ($response->getStatus() === 404)
{
dump($titles);
die();
$badMappings[$id] = $titles;
}
else
@ -177,8 +174,6 @@ final class MALIDCheck extends BaseCommand {
if (mb_stripos($body, $title) !== FALSE)
{
// echo "MAL id {$id} seems to match \"{$title}\"\n";
$titleMatches = TRUE;
$goodMappings[$id] = $title;
@ -209,7 +204,7 @@ final class MALIDCheck extends BaseCommand {
{
$baseUrl = "https://myanimelist.net/{$type}/";
$requestChunks = array_chunk($ids, 10, TRUE);
$requestChunks = array_chunk($ids, 50, TRUE);
$responses = [];
// Chunk parallel requests so that we don't hit rate
@ -221,7 +216,6 @@ final class MALIDCheck extends BaseCommand {
foreach($idChunk as $id)
{
$request = APIRequestBuilder::simpleRequest($baseUrl . $id);
echo "Checking {$baseUrl}{$id} \n";
$requester->addRequest($request, (string)$id);
}
@ -229,12 +223,6 @@ final class MALIDCheck extends BaseCommand {
{
$responses[$id] = $response;
}
echo "Finished checking chunk of 10 entries\n";
// Rate limiting is annoying :(
// sleep(1);
// time_nanosleep(0, 250 * MILLI_FROM_NANO);
}
return $responses;