Version 5.1 - All the GraphQL #32

Closed
timw4mail wants to merge 1160 commits from develop into master
5 changed files with 15 additions and 13 deletions
Showing only changes of commit 4d29b43123 - Show all commits

View File

@ -97,19 +97,19 @@ final class ListItem implements ListItemInterface{
* @return Request
*/
public function update(string $id, FormItemData $data): Request
{
{
$array = $data->toArray();
$notes = $data['notes'] ?? '';
$progress = array_key_exists('progress', $array) ? $data['progress'] : 0;
$private = array_key_exists('private', $array) ? (bool)$data['private'] : false;
$rating = array_key_exists('rating', $array) ? $data['rating'] : NULL;
$rating = array_key_exists('ratingTwenty', $array) ? $data['ratingTwenty'] : NULL;
$status = ($data['reconsuming'] === true) ? AnilistStatus::REPEATING : AnimeWatchingStatus::KITSU_TO_ANILIST[$data['status']];
$updateData = [
'id' => (int)$id,
'status' => $status,
'score' => $rating * 10,
'score' => $rating * 5,
'progress' => $progress,
'repeat' => (int)$data['reconsumeCount'],
'private' => $private,

View File

@ -89,14 +89,14 @@ final class Model
throw new InvalidArgumentException('Media id missing');
}
if ($type === 'anime')
if ($type === 'ANIME')
{
$createData = [
'id' => $mediaId,
'status' => AnimeWatchingStatus::KITSU_TO_ANILIST[$data['status']],
];
}
elseif ($type === 'manga')
elseif ($type === 'MANGA')
{
$createData = [
'id' => $mediaId,

View File

@ -1,4 +1,4 @@
<?php declare(strict_types=1);
<?php // declare(strict_types=1);
/**
* Hummingbird Anime List Client
*

View File

@ -66,6 +66,8 @@ final class SyncLists extends BaseCommand {
$this->sync('anime');
$this->sync('manga');
$this->echoBox('Finished syncing lists');
}
/**
@ -363,7 +365,7 @@ final class SyncLists extends BaseCommand {
'private' => $kItem['private'],
'progress' => $kItem['progress'],
'repeat' => $kItem['reconsumeCount'],
'score' => $kItem['ratingTwenty'] / 2,
'score' => $kItem['ratingTwenty'] * 5, // 100 point score on Anilist
'status' => $newItemStatus,
],
];
@ -425,7 +427,7 @@ final class SyncLists extends BaseCommand {
$sameNotes = $diff['notes'] === 0;
$sameStatus = $diff['status'] === 0;
$sameProgress = $diff['progress'] === 0;
$sameRating = $diff['rating'] === 0;
$sameRating = $diff['ratingTwenty'] === 0;
$sameRewatchCount = $diff['reconsumeCount'] === 0;
// If an item is completed, make sure the 'reconsuming' flag is false
@ -497,12 +499,12 @@ final class SyncLists extends BaseCommand {
{
if ($kitsuItem['data']['rating'] !== 0 && $dateDiff === 1)
{
$update['data']['rating'] = $kitsuItem['data']['rating'];
$update['data']['ratingTwenty'] = $kitsuItem['data']['ratingTwenty'];
$return['updateType'][] = 'anilist';
}
else if($dateDiff === -1)
{
$update['data']['rating'] = $anilistItem['data']['rating'];
$update['data']['ratingTwenty'] = $anilistItem['data']['rating'] * 2;
$return['updateType'][] = 'kitsu';
}
}
@ -557,7 +559,7 @@ final class SyncLists extends BaseCommand {
'notes' => $kitsuItem['data']['notes'],
'private' => $kitsuItem['data']['private'],
'progress' => $kitsuItem['data']['progress'],
'rating' => $kitsuItem['data']['rating'],
'rating' => $kitsuItem['data']['ratingTwenty'] * 5,
'reconsumeCount' => $kitsuItem['data']['reconsumeCount'],
'reconsuming' => $kitsuItem['data']['reconsuming'],
'status' => $kitsuItem['data']['status'],

View File

@ -201,7 +201,7 @@ final class Index extends BaseController {
public function images(string $type, string $file): void
{
$kitsuUrl = 'https://media.kitsu.io/';
list($id, $ext) = explode('.', basename($file));
[$id, $ext] = explode('.', basename($file));
switch ($type)
{
case 'anime':