From 891d8af46967e07b425ea17fbdc4069c5b8604c7 Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Mon, 18 May 2020 12:52:32 -0400 Subject: [PATCH] Remove extra titles from list/cover display --- src/AnimeClient/API/Kitsu.php | 135 +++++++++++++++++----------------- 1 file changed, 68 insertions(+), 67 deletions(-) diff --git a/src/AnimeClient/API/Kitsu.php b/src/AnimeClient/API/Kitsu.php index 441525cd..51b85e3a 100644 --- a/src/AnimeClient/API/Kitsu.php +++ b/src/AnimeClient/API/Kitsu.php @@ -60,73 +60,6 @@ final class Kitsu { return AnimeAiringStatus::NOT_YET_AIRED; } - /** - * Get the name and logo for the streaming service of the current link - * - * @param string $hostname - * @return array - */ - protected static function getServiceMetaData(string $hostname = NULL): array - { - $hostname = str_replace('www.', '', $hostname); - - $serviceMap = [ - 'amazon.com' => [ - 'name' => 'Amazon Prime', - 'link' => TRUE, - 'image' => 'streaming-logos/amazon.svg', - ], - 'crunchyroll.com' => [ - 'name' => 'Crunchyroll', - 'link' => TRUE, - 'image' => 'streaming-logos/crunchyroll.svg', - ], - 'daisuki.net' => [ - 'name' => 'Daisuki', - 'link' => TRUE, - 'image' => 'streaming-logos/daisuki.svg' - ], - 'funimation.com' => [ - 'name' => 'Funimation', - 'link' => TRUE, - 'image' => 'streaming-logos/funimation.svg', - ], - 'hidive.com' => [ - 'name' => 'Hidive', - 'link' => TRUE, - 'image' => 'streaming-logos/hidive.svg', - ], - 'hulu.com' => [ - 'name' => 'Hulu', - 'link' => TRUE, - 'image' => 'streaming-logos/hulu.svg', - ], - 'tubitv.com' => [ - 'name' => 'TubiTV', - 'link' => TRUE, - 'image' => 'streaming-logos/tubitv.svg', - ], - 'viewster.com' => [ - 'name' => 'Viewster', - 'link' => TRUE, - 'image' => 'streaming-logos/viewster.svg' - ], - ]; - - if (array_key_exists($hostname, $serviceMap)) - { - return $serviceMap[$hostname]; - } - - // Default to Netflix, because the API links are broken, - // and there's no other real identifier for Netflix - return [ - 'name' => 'Netflix', - 'link' => FALSE, - 'image' => 'streaming-logos/netflix.svg', - ]; - } - /** * Reorganize streaming links * @@ -242,6 +175,74 @@ final class Kitsu { return $valid; } + + /** + * Get the name and logo for the streaming service of the current link + * + * @param string $hostname + * @return array + */ + protected static function getServiceMetaData(string $hostname = NULL): array + { + $hostname = str_replace('www.', '', $hostname); + + $serviceMap = [ + 'amazon.com' => [ + 'name' => 'Amazon Prime', + 'link' => TRUE, + 'image' => 'streaming-logos/amazon.svg', + ], + 'crunchyroll.com' => [ + 'name' => 'Crunchyroll', + 'link' => TRUE, + 'image' => 'streaming-logos/crunchyroll.svg', + ], + 'daisuki.net' => [ + 'name' => 'Daisuki', + 'link' => TRUE, + 'image' => 'streaming-logos/daisuki.svg' + ], + 'funimation.com' => [ + 'name' => 'Funimation', + 'link' => TRUE, + 'image' => 'streaming-logos/funimation.svg', + ], + 'hidive.com' => [ + 'name' => 'Hidive', + 'link' => TRUE, + 'image' => 'streaming-logos/hidive.svg', + ], + 'hulu.com' => [ + 'name' => 'Hulu', + 'link' => TRUE, + 'image' => 'streaming-logos/hulu.svg', + ], + 'tubitv.com' => [ + 'name' => 'TubiTV', + 'link' => TRUE, + 'image' => 'streaming-logos/tubitv.svg', + ], + 'viewster.com' => [ + 'name' => 'Viewster', + 'link' => TRUE, + 'image' => 'streaming-logos/viewster.svg' + ], + ]; + + if (array_key_exists($hostname, $serviceMap)) + { + return $serviceMap[$hostname]; + } + + // Default to Netflix, because the API links are broken, + // and there's no other real identifier for Netflix + return [ + 'name' => 'Netflix', + 'link' => FALSE, + 'image' => 'streaming-logos/netflix.svg', + ]; + } + /** * Determine if an alternate title is unique enough to list *