From 6e9fb574185754828d7c431f7122c281db40a5f1 Mon Sep 17 00:00:00 2001 From: Nihal Mirpuri Date: Thu, 20 Jun 2024 15:28:06 +0100 Subject: [PATCH] Fix RSS Urls (#159) --- src/main/scala/plex/PlexUtils.scala | 7 +++++-- src/test/scala/plex/PlexUtilsSpec.scala | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/scala/plex/PlexUtils.scala b/src/main/scala/plex/PlexUtils.scala index aeb93ea..c95d1c0 100644 --- a/src/main/scala/plex/PlexUtils.scala +++ b/src/main/scala/plex/PlexUtils.scala @@ -19,8 +19,10 @@ trait PlexUtils { implicit val customConfig: extras.Configuration = extras.Configuration.default.withDefaults - protected def fetchWatchlistFromRss(client: HttpClient)(url: Uri): IO[Set[Item]] = - client.httpRequest(Method.GET, url).map { + protected def fetchWatchlistFromRss(client: HttpClient)(url: Uri): IO[Set[Item]] = { + val jsonFormatUrl = url.withQueryParam("format", "json") + + client.httpRequest(Method.GET, jsonFormatUrl).map { case Left(err) => logger.warn(s"Unable to fetch watchlist from Plex: $err") Set.empty @@ -31,6 +33,7 @@ trait PlexUtils { Set.empty } } + } protected def ping(client: HttpClient)(config: PlexConfiguration): IO[Unit] = config.plexTokens diff --git a/src/test/scala/plex/PlexUtilsSpec.scala b/src/test/scala/plex/PlexUtilsSpec.scala index 76715c0..7763a13 100644 --- a/src/test/scala/plex/PlexUtilsSpec.scala +++ b/src/test/scala/plex/PlexUtilsSpec.scala @@ -23,7 +23,7 @@ class PlexUtilsSpec extends AnyFlatSpec with Matchers with PlexUtils with MockFa (mockClient.httpRequest _) .expects( Method.GET, - Uri.unsafeFromString("http://localhost:9090"), + Uri.unsafeFromString("http://localhost:9090?format=json"), None, None ) @@ -40,7 +40,7 @@ class PlexUtilsSpec extends AnyFlatSpec with Matchers with PlexUtils with MockFa (mockClient.httpRequest _) .expects( Method.GET, - Uri.unsafeFromString("http://localhost:9090"), + Uri.unsafeFromString("http://localhost:9090?format=json"), None, None )