diff --git a/lib/Controller/SearchController.php b/lib/Controller/SearchController.php index 1b9c131..c45cc9b 100644 --- a/lib/Controller/SearchController.php +++ b/lib/Controller/SearchController.php @@ -10,11 +10,13 @@ use OCA\RePod\Service\ItunesService; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\JSONResponse; use OCP\IRequest; +use Psr\Log\LoggerInterface; class SearchController extends Controller { public function __construct( IRequest $request, + private LoggerInterface $logger, private FyydService $fyydService, private ItunesService $itunesService ) { @@ -30,6 +32,7 @@ class SearchController extends Controller try { $podcasts = [...$podcasts, ...$provider->search($value)]; } catch (\Exception $e) { + $this->logger->error($e->getMessage(), $e->getTrace()); } } diff --git a/lib/Service/FyydService.php b/lib/Service/FyydService.php index fb7115e..03c5e19 100644 --- a/lib/Service/FyydService.php +++ b/lib/Service/FyydService.php @@ -8,6 +8,7 @@ use OCP\Http\Client\IClientService; use OCP\Http\Client\IResponse; use OCP\IUserSession; use OCP\L10N\IFactory; +use Psr\Log\LoggerInterface; class FyydService implements IProvider { @@ -17,7 +18,8 @@ class FyydService implements IProvider private UserService $userService, private IClientService $clientService, private IFactory $l10n, - private IUserSession $userSession + private IUserSession $userSession, + private LoggerInterface $logger ) { } @@ -68,6 +70,7 @@ class FyydService implements IProvider $language = in_array($userLang, $langJson['data']) ? $userLang : 'en'; } } catch (\Exception $e) { + $this->logger->error($e->getMessage(), $e->getTrace()); } $podcastClient = $this->clientService->newClient(); diff --git a/lib/Service/ItunesService.php b/lib/Service/ItunesService.php index 927d700..0813cde 100644 --- a/lib/Service/ItunesService.php +++ b/lib/Service/ItunesService.php @@ -30,7 +30,7 @@ class ItunesService implements IProvider ]); $json = (array) json_decode((string) $response->getBody(), true, flags: JSON_THROW_ON_ERROR); - if (array_key_exists('data', $json) && is_array($json['data'])) { + if (array_key_exists('results', $json) && is_array($json['results'])) { /** @var string[] $feed */ foreach ($json['results'] as $feed) { $podcasts[] = [