From 5bf8277376f2354479a30ac2b61b78dac32e3c83 Mon Sep 17 00:00:00 2001 From: Timothy J Warren Date: Thu, 11 Jul 2019 15:24:34 -0400 Subject: [PATCH] Fix syncing manga to anilist when you have to create a new list item --- src/API/Anilist/Model.php | 6 ++++-- src/Command/SyncLists.php | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/API/Anilist/Model.php b/src/API/Anilist/Model.php index 6e1d4845..3e75f23a 100644 --- a/src/API/Anilist/Model.php +++ b/src/API/Anilist/Model.php @@ -151,12 +151,13 @@ final class Model * Create a list item with all the relevant data * * @param array $data + * @param string $type * @return Request */ - public function createFullListItem(array $data): Request + public function createFullListItem(array $data, string $type): Request { $createData = $data['data']; - $mediaId = $this->getMediaIdFromMalId($data['mal_id']); + $mediaId = $this->getMediaIdFromMalId($data['mal_id'], strtoupper($type)); $createData['id'] = $mediaId; @@ -213,6 +214,7 @@ final class Model * Remove a list item * * @param string $malId - The id of the list item to remove + * @param string $type - Them media type (anime/manga) * @return Request */ public function deleteListItem(string $malId, string $type): Request diff --git a/src/Command/SyncLists.php b/src/Command/SyncLists.php index c1917cd1..db689be7 100644 --- a/src/Command/SyncLists.php +++ b/src/Command/SyncLists.php @@ -325,6 +325,7 @@ final class SyncLists extends BaseCommand { $missingMalIds = array_diff($malIds, $kitsuMalIds); $missingMalIds = array_diff($missingMalIds, $malBlackList); + // Add items on Anilist, but not Kitsu to Kitsu foreach($missingMalIds as $mid) { $itemsToAddToKitsu[] = array_merge($anilistList[$mid]['data'], [