remove duplicates in latest

This commit is contained in:
paronos 2018-04-26 20:52:48 +02:00
parent 7786fa9f90
commit 717af15488
2 changed files with 16 additions and 6 deletions

View File

@ -5,8 +5,8 @@ ext {
appName = 'Tachiyomi: FoolSlide'
pkgNameSuffix = "all.foolslide"
extClass = '.FoolSlideFactory'
extVersionCode = 3
extVersionSuffix = 3
extVersionCode = 4
extVersionSuffix = 4
libVersion = '1.2'
}
dependencies {

View File

@ -4,13 +4,11 @@ import com.github.salomonbrys.kotson.get
import com.google.gson.JsonParser
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.POST
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.*
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
import okhttp3.FormBody
import okhttp3.Request
import okhttp3.Response
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import java.text.ParseException
@ -28,9 +26,21 @@ open class FoolSlide(override val name: String, override val baseUrl: String, ov
return GET("$baseUrl$urlModifier/directory/$page/", headers)
}
private val latestUpdatesUrls = HashSet<String>()
override fun latestUpdatesParse(response: Response): MangasPage {
val mp = super.latestUpdatesParse(response)
val mangas = mp.mangas.distinctBy { it.url }.filterNot { latestUpdatesUrls.contains(it.url) }
latestUpdatesUrls.addAll(mangas.map { it.url })
return MangasPage(mangas, mp.hasNextPage)
}
override fun latestUpdatesSelector() = "div.group"
override fun latestUpdatesRequest(page: Int): Request {
if (page == 1) {
latestUpdatesUrls.clear()
}
return GET("$baseUrl$urlModifier/latest/$page/")
}