diff --git a/app/views/anime/cover.php b/app/views/anime/cover.php
index 41bd3f4b..bd5d4bc2 100644
--- a/app/views/anime/cover.php
+++ b/app/views/anime/cover.php
@@ -54,7 +54,7 @@
-
+
= $link['meta']['logo'] ?>
diff --git a/src/API/Kitsu.php b/src/API/Kitsu.php
index 6a17f941..e83c0be4 100644
--- a/src/API/Kitsu.php
+++ b/src/API/Kitsu.php
@@ -161,6 +161,39 @@ class Kitsu {
return $links;
}
+
+ /**
+ * Reorganize streaming links for the current list item
+ *
+ * @param array $included
+ * @return array
+ */
+ public static function parseListItemStreamingLinks(array $included, string $animeId): array
+ {
+ // Anime lists have a different structure to search through
+ if (array_key_exists('anime', $included) && ! array_key_exists('streamingLinks', $included))
+ {
+ $links = [];
+ $anime = $included['anime'][$animeId];
+
+ if (count($anime['relationships']['streamingLinks']) > 0)
+ {
+ foreach ($anime['relationships']['streamingLinks'] as $streamingLink)
+ {
+ $host = parse_url($streamingLink['url'], \PHP_URL_HOST);
+
+ $links[] = [
+ 'meta' => static::getServiceMetaData($host),
+ 'link' => $streamingLink['url'],
+ 'subs' => $streamingLink['subs'],
+ 'dubs' => $streamingLink['dubs']
+ ];
+ }
+ }
+
+ return $links;
+ }
+ }
/**
* Filter out duplicate and very similar names from
diff --git a/src/API/Kitsu/KitsuModel.php b/src/API/Kitsu/KitsuModel.php
index 97bd7998..47fb8046 100644
--- a/src/API/Kitsu/KitsuModel.php
+++ b/src/API/Kitsu/KitsuModel.php
@@ -175,7 +175,7 @@ class KitsuModel {
'include' => 'media,media.genres,media.mappings,anime.streamingLinks',
'page' => [
'offset' => 0,
- 'limit' => 500
+ 'limit' => 600
]
]
];
diff --git a/src/API/Kitsu/Transformer/AnimeListTransformer.php b/src/API/Kitsu/Transformer/AnimeListTransformer.php
index e153a2a1..1c94d3d0 100644
--- a/src/API/Kitsu/Transformer/AnimeListTransformer.php
+++ b/src/API/Kitsu/Transformer/AnimeListTransformer.php
@@ -60,6 +60,8 @@ class AnimeListTransformer extends AbstractTransformer {
}
}
}
+
+ $streamingLinks = Kitsu::parseListItemStreamingLinks($included, $animeId);
return [
'id' => $item['id'],
@@ -78,12 +80,13 @@ class AnimeListTransformer extends AbstractTransformer {
],
'anime' => [
'age_rating' => $anime['ageRating'],
+ 'title' => $anime['canonicalTitle'],
'titles' => Kitsu::filterTitles($anime),
'slug' => $anime['slug'],
'type' => $this->string($anime['showType'])->upperCaseFirst()->__toString(),
'image' => $anime['posterImage']['small'],
'genres' => $genres,
- 'streaming_links' => Kitsu::parseStreamingLinks($included),
+ 'streaming_links' => $streamingLinks,
],
'watching_status' => $item['attributes']['status'],
'notes' => $item['attributes']['notes'],
diff --git a/src/Model/API.php b/src/Model/API.php
index 40797eb4..d2c423af 100644
--- a/src/Model/API.php
+++ b/src/Model/API.php
@@ -34,7 +34,7 @@ class API extends Model {
/**
* Cache manager
- * @var \Aviat\Ion\Cache\CacheInterface
+ * @var \Psr\Cache\CacheItemPoolInterface
*/
protected $cache;
@@ -56,7 +56,7 @@ class API extends Model {
}
/**
- * Sort the manga entries by their title
+ * Sort the list entries by their title
*
* @codeCoverageIgnore
* @param array $array
@@ -75,4 +75,3 @@ class API extends Model {
array_multisort($sort, SORT_ASC, $array);
}
}
-// End of BaseApiModel.php