Emerald: De-duplicate search results (#4879)

* appveyor

* deduplicate emerald search results

* rm appveyor

* update build.gradle
This commit is contained in:
arkon 2020-11-14 15:05:42 -05:00 committed by GitHub
commit 9e2b6da01c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'Emerald'
pkgNameSuffix = 'all.emerald'
extClass = '.EmeraldFactory'
extVersionCode = 6
extVersionCode = 7
libVersion = '1.2'
}

View File

@ -7,10 +7,12 @@ import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.model.MangasPage
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
import okhttp3.HttpUrl
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.Response
import org.json.JSONArray
import org.json.JSONObject
import org.jsoup.nodes.Document
@ -153,6 +155,15 @@ open class Emerald(
override fun searchMangaNextPageSelector() = latestUpdatesNextPageSelector()
private val searchMangaTitles = HashSet<String>()
override fun searchMangaParse(response: Response): MangasPage {
val mp = super.searchMangaParse(response)
val manga = mp.mangas.distinctBy { it.title.toLowerCase() }.filterNot { searchMangaTitles.contains(it.title.toLowerCase()) }
searchMangaTitles.addAll(manga.map { it.title.toLowerCase() })
return MangasPage(manga, mp.hasNextPage)
}
override fun mangaDetailsRequest(manga: SManga): Request {
if (manga.url.startsWith("http")) {
return GET(manga.url, headers)