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 )