mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-08 23:51:21 +02:00
Updates to Seerr image fetching (#1086)
## Description This PR makes changes to how images are fetched for discover/Seerr items. If the discovered item is available on the Jellyfin server, the images will be fetched from the Jellyfin server. Then if the Seerr server has image caching enabled, the images will be fetched from the Seerr server. Otherwise, images are fetched from TMDB . TMDB was the previous behavior for all images. ### Dev notes This PR also updates the Seerr server URLs stored in the database, so it's not backwards compatible. ### Related issues Fixes #1079 ### Testing Emulator against Jellyseer 2.7.3 & Seerr 3.0.1 ## Screenshots N/A ## AI or LLM usage None
This commit is contained in:
parent
2da55bb616
commit
627b89f1db
15 changed files with 536 additions and 327 deletions
|
|
@ -1,7 +1,9 @@
|
|||
package com.github.damontecres.wholphin.test
|
||||
|
||||
import com.github.damontecres.wholphin.ui.setup.seerr.createSeerrApiUrl
|
||||
import com.github.damontecres.wholphin.ui.setup.seerr.createUrls
|
||||
import org.junit.Assert
|
||||
import com.github.damontecres.wholphin.ui.setup.seerr.migrateSeerrUrl
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
class TestSeerr {
|
||||
|
|
@ -13,12 +15,12 @@ class TestSeerr {
|
|||
|
||||
val expected =
|
||||
listOf(
|
||||
"http://jellyseerr.com/api/v1",
|
||||
"https://jellyseerr.com/api/v1",
|
||||
"http://jellyseerr.com:5055/api/v1",
|
||||
"https://jellyseerr.com:5055/api/v1",
|
||||
"http://jellyseerr.com/",
|
||||
"https://jellyseerr.com/",
|
||||
"http://jellyseerr.com:5055/",
|
||||
"https://jellyseerr.com:5055/",
|
||||
)
|
||||
Assert.assertEquals(expected, urls)
|
||||
assertEquals(expected, urls)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -29,10 +31,10 @@ class TestSeerr {
|
|||
|
||||
val expected =
|
||||
listOf(
|
||||
"https://jellyseerr.com/api/v1",
|
||||
"https://jellyseerr.com:5055/api/v1",
|
||||
"https://jellyseerr.com/",
|
||||
"https://jellyseerr.com:5055/",
|
||||
)
|
||||
Assert.assertEquals(expected, urls)
|
||||
assertEquals(expected, urls)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -43,10 +45,10 @@ class TestSeerr {
|
|||
|
||||
val expected =
|
||||
listOf(
|
||||
"http://jellyseerr.com/api/v1",
|
||||
"http://jellyseerr.com:5055/api/v1",
|
||||
"http://jellyseerr.com/",
|
||||
"http://jellyseerr.com:5055/",
|
||||
)
|
||||
Assert.assertEquals(expected, urls)
|
||||
assertEquals(expected, urls)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -57,10 +59,10 @@ class TestSeerr {
|
|||
|
||||
val expected =
|
||||
listOf(
|
||||
"http://jellyseerr.com:5055/api/v1",
|
||||
"https://jellyseerr.com:5055/api/v1",
|
||||
"http://jellyseerr.com:5055/",
|
||||
"https://jellyseerr.com:5055/",
|
||||
)
|
||||
Assert.assertEquals(expected, urls)
|
||||
assertEquals(expected, urls)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -71,10 +73,10 @@ class TestSeerr {
|
|||
|
||||
val expected =
|
||||
listOf(
|
||||
"http://10.0.0.2:443/api/v1",
|
||||
"https://10.0.0.2/api/v1",
|
||||
"http://10.0.0.2:443/",
|
||||
"https://10.0.0.2/",
|
||||
)
|
||||
Assert.assertEquals(expected, urls)
|
||||
assertEquals(expected, urls)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -85,9 +87,87 @@ class TestSeerr {
|
|||
|
||||
val expected =
|
||||
listOf(
|
||||
"http://10.0.0.2:8080/api/v1",
|
||||
"https://10.0.0.2:8080/api/v1",
|
||||
"http://10.0.0.2:8080/",
|
||||
"https://10.0.0.2:8080/",
|
||||
)
|
||||
Assert.assertEquals(expected, urls)
|
||||
assertEquals(expected, urls)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testCreateUrls7() {
|
||||
val urls =
|
||||
createUrls("http://10.0.0.2:80")
|
||||
.map { it.toString() }
|
||||
|
||||
val expected =
|
||||
listOf(
|
||||
"http://10.0.0.2/",
|
||||
"http://10.0.0.2:5055/",
|
||||
)
|
||||
assertEquals(expected, urls)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testCreateUrls8() {
|
||||
val urls =
|
||||
createUrls("https://10.0.0.2:443")
|
||||
.map { it.toString() }
|
||||
|
||||
val expected =
|
||||
listOf(
|
||||
"https://10.0.0.2/",
|
||||
"https://10.0.0.2:5055/",
|
||||
)
|
||||
assertEquals(expected, urls)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Test createUrls for path`() {
|
||||
val urls =
|
||||
createUrls("https://jellyseerr.com/seerr/")
|
||||
.map { it.toString() }
|
||||
|
||||
val expected =
|
||||
listOf(
|
||||
"https://jellyseerr.com/seerr/",
|
||||
"https://jellyseerr.com:5055/seerr/",
|
||||
)
|
||||
assertEquals(expected, urls)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Test build api url`() {
|
||||
var url = "https://jellyseerr.com/"
|
||||
assertEquals("https://jellyseerr.com/api/v1", createSeerrApiUrl(url))
|
||||
|
||||
url = "https://jellyseerr.com/path"
|
||||
assertEquals("https://jellyseerr.com/path/api/v1", createSeerrApiUrl(url))
|
||||
|
||||
url = "http://jellyseerr.com:5055/"
|
||||
assertEquals("http://jellyseerr.com:5055/api/v1", createSeerrApiUrl(url))
|
||||
|
||||
url = "http://jellyseerr.com:7878/path/"
|
||||
assertEquals("http://jellyseerr.com:7878/path/api/v1", createSeerrApiUrl(url))
|
||||
|
||||
url = "http://jellyseerr.com/api/v1"
|
||||
assertEquals("http://jellyseerr.com/api/v1", createSeerrApiUrl(url))
|
||||
|
||||
url = "http://jellyseerr.com/api/v1/"
|
||||
assertEquals("http://jellyseerr.com/api/v1/", createSeerrApiUrl(url))
|
||||
|
||||
url = "http://jellyseerr.com/path/api/v1"
|
||||
assertEquals("http://jellyseerr.com/path/api/v1", createSeerrApiUrl(url))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Test migration`() {
|
||||
assertEquals("http://10.0.0.2/", migrateSeerrUrl("http://10.0.0.2/api/v1"))
|
||||
assertEquals("https://10.0.0.2/", migrateSeerrUrl("https://10.0.0.2/api/v1"))
|
||||
assertEquals("http://10.0.0.2:5055/", migrateSeerrUrl("http://10.0.0.2:5055/api/v1"))
|
||||
assertEquals("http://10.0.0.2/", migrateSeerrUrl("http://10.0.0.2/api/v1/"))
|
||||
assertEquals("http://10.0.0.2/path/", migrateSeerrUrl("http://10.0.0.2/path/api/v1"))
|
||||
assertEquals("http://10.0.0.2/api/v1/", migrateSeerrUrl("http://10.0.0.2/api/v1/api/v1"))
|
||||
assertEquals("http://10.0.0.2/", migrateSeerrUrl("http://10.0.0.2/"))
|
||||
assertEquals("http://10.0.0.2/", migrateSeerrUrl("http://10.0.0.2"))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue