Skip to content

Commit

Permalink
Fix RSS Urls (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
nylonee committed Jun 20, 2024
1 parent cb4384d commit 6e9fb57
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/main/scala/plex/PlexUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -31,6 +33,7 @@ trait PlexUtils {
Set.empty
}
}
}

protected def ping(client: HttpClient)(config: PlexConfiguration): IO[Unit] =
config.plexTokens
Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/plex/PlexUtilsSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand All @@ -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
)
Expand Down

0 comments on commit 6e9fb57

Please sign in to comment.