Fix syncing manga to anilist when you have to create a new list item
This commit is contained in:
parent
038e61bf37
commit
ea5eb21941
@ -151,12 +151,13 @@ final class Model
|
|||||||
* Create a list item with all the relevant data
|
* Create a list item with all the relevant data
|
||||||
*
|
*
|
||||||
* @param array $data
|
* @param array $data
|
||||||
|
* @param string $type
|
||||||
* @return Request
|
* @return Request
|
||||||
*/
|
*/
|
||||||
public function createFullListItem(array $data): Request
|
public function createFullListItem(array $data, string $type): Request
|
||||||
{
|
{
|
||||||
$createData = $data['data'];
|
$createData = $data['data'];
|
||||||
$mediaId = $this->getMediaIdFromMalId($data['mal_id']);
|
$mediaId = $this->getMediaIdFromMalId($data['mal_id'], strtoupper($type));
|
||||||
|
|
||||||
$createData['id'] = $mediaId;
|
$createData['id'] = $mediaId;
|
||||||
|
|
||||||
@ -213,6 +214,7 @@ final class Model
|
|||||||
* Remove a list item
|
* Remove a list item
|
||||||
*
|
*
|
||||||
* @param string $malId - The id of the list item to remove
|
* @param string $malId - The id of the list item to remove
|
||||||
|
* @param string $type - Them media type (anime/manga)
|
||||||
* @return Request
|
* @return Request
|
||||||
*/
|
*/
|
||||||
public function deleteListItem(string $malId, string $type): Request
|
public function deleteListItem(string $malId, string $type): Request
|
||||||
|
@ -325,6 +325,7 @@ final class SyncLists extends BaseCommand {
|
|||||||
$missingMalIds = array_diff($malIds, $kitsuMalIds);
|
$missingMalIds = array_diff($malIds, $kitsuMalIds);
|
||||||
$missingMalIds = array_diff($missingMalIds, $malBlackList);
|
$missingMalIds = array_diff($missingMalIds, $malBlackList);
|
||||||
|
|
||||||
|
// Add items on Anilist, but not Kitsu to Kitsu
|
||||||
foreach($missingMalIds as $mid)
|
foreach($missingMalIds as $mid)
|
||||||
{
|
{
|
||||||
$itemsToAddToKitsu[] = array_merge($anilistList[$mid]['data'], [
|
$itemsToAddToKitsu[] = array_merge($anilistList[$mid]['data'], [
|
||||||
|
Loading…
Reference in New Issue
Block a user