Version 5.1 - All the GraphQL #32
@ -144,13 +144,16 @@ abstract class BaseCommand extends Command {
|
|||||||
{
|
{
|
||||||
if ($fgColor !== NULL)
|
if ($fgColor !== NULL)
|
||||||
{
|
{
|
||||||
$fgColor = (string)$fgColor;
|
$fgColor = (int)$fgColor;
|
||||||
}
|
}
|
||||||
if ($bgColor !== NULL)
|
if ($bgColor !== NULL)
|
||||||
{
|
{
|
||||||
$bgColor = (string)$bgColor;
|
$bgColor = (int)$bgColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Colorize the CLI output
|
||||||
|
// the documented type for the function is wrong
|
||||||
|
// @phpstan-ignore-next-line
|
||||||
$message = Colors::colorize($message, $fgColor, $bgColor);
|
$message = Colors::colorize($message, $fgColor, $bgColor);
|
||||||
$this->getConsole()->writeln($message);
|
$this->getConsole()->writeln($message);
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
namespace Aviat\AnimeClient\Command;
|
namespace Aviat\AnimeClient\Command;
|
||||||
|
|
||||||
|
use Aviat\Ion\JsonException;
|
||||||
use ConsoleKit\Widgets;
|
use ConsoleKit\Widgets;
|
||||||
|
|
||||||
use Aviat\AnimeClient\API\{
|
use Aviat\AnimeClient\API\{
|
||||||
@ -287,9 +288,17 @@ final class SyncLists extends BaseCommand {
|
|||||||
|
|
||||||
// This uses a static so I don't have to fetch this list twice for a count
|
// This uses a static so I don't have to fetch this list twice for a count
|
||||||
if ($list[$type] === NULL)
|
if ($list[$type] === NULL)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
$list[$type] = $this->anilistModel->getSyncList(strtoupper($type));
|
$list[$type] = $this->anilistModel->getSyncList(strtoupper($type));
|
||||||
}
|
}
|
||||||
|
catch (JsonException)
|
||||||
|
{
|
||||||
|
$this->echoErrorBox('Anlist API exception. Can not sync.');
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $list[$type];
|
return $list[$type];
|
||||||
}
|
}
|
||||||
@ -599,7 +608,7 @@ final class SyncLists extends BaseCommand {
|
|||||||
$kitsuItem['data']['ratingTwenty'] !== 0
|
$kitsuItem['data']['ratingTwenty'] !== 0
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
$update['data']['ratingTwenty'] = $kitsuItem['data']['ratingTwenty'];
|
$update['data']['ratingTwenty'] = $kitsuItem['data']['rating'];
|
||||||
$return['updateType'][] = Enum\API::ANILIST;
|
$return['updateType'][] = Enum\API::ANILIST;
|
||||||
}
|
}
|
||||||
else if($dateDiff === self::ANILIST_GREATER && $anilistItem['data']['rating'] !== 0)
|
else if($dateDiff === self::ANILIST_GREATER && $anilistItem['data']['rating'] !== 0)
|
||||||
|
@ -228,7 +228,7 @@ final class Anime extends BaseController {
|
|||||||
$postData = $transformer->untransform($data);
|
$postData = $transformer->untransform($data);
|
||||||
$fullResult = $this->model->updateLibraryItem(FormItem::from($postData));
|
$fullResult = $this->model->updateLibraryItem(FormItem::from($postData));
|
||||||
|
|
||||||
if ($fullResult['statusCode'] === 200)
|
if ($fullResult['statusCode'] === 200 && $fullResult['body']['error'] === NULL)
|
||||||
{
|
{
|
||||||
$this->setFlashMessage('Successfully updated.', 'success');
|
$this->setFlashMessage('Successfully updated.', 'success');
|
||||||
$this->cache->clear();
|
$this->cache->clear();
|
||||||
|
@ -229,7 +229,7 @@ final class Manga extends Controller {
|
|||||||
$post_data = $transformer->untransform($data);
|
$post_data = $transformer->untransform($data);
|
||||||
$full_result = $this->model->updateLibraryItem(FormItem::from($post_data));
|
$full_result = $this->model->updateLibraryItem(FormItem::from($post_data));
|
||||||
|
|
||||||
if ($full_result['statusCode'] === 200)
|
if ($full_result['statusCode'] === 200 && $full_result['body']['error'] === NULL)
|
||||||
{
|
{
|
||||||
$this->setFlashMessage('Successfully updated manga.', 'success');
|
$this->setFlashMessage('Successfully updated manga.', 'success');
|
||||||
$this->cache->clear();
|
$this->cache->clear();
|
||||||
|
Loading…
Reference in New Issue
Block a user