Merge pull request #312 from paronos/foolslide

FoolSlide: remove duplicates in latest
This commit is contained in:
Carlos 2018-04-26 15:34:41 -04:00 committed by GitHub
commit dc80cff934
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 6 deletions

View File

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

View File

@ -4,13 +4,11 @@ import com.github.salomonbrys.kotson.get
import com.google.gson.JsonParser import com.google.gson.JsonParser
import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.POST import eu.kanade.tachiyomi.network.POST
import eu.kanade.tachiyomi.source.model.FilterList import eu.kanade.tachiyomi.source.model.*
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.online.ParsedHttpSource import eu.kanade.tachiyomi.source.online.ParsedHttpSource
import okhttp3.FormBody import okhttp3.FormBody
import okhttp3.Request import okhttp3.Request
import okhttp3.Response
import org.jsoup.nodes.Document import org.jsoup.nodes.Document
import org.jsoup.nodes.Element import org.jsoup.nodes.Element
import java.text.ParseException 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) 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 latestUpdatesSelector() = "div.group"
override fun latestUpdatesRequest(page: Int): Request { override fun latestUpdatesRequest(page: Int): Request {
if (page == 1) {
latestUpdatesUrls.clear()
}
return GET("$baseUrl$urlModifier/latest/$page/") return GET("$baseUrl$urlModifier/latest/$page/")
} }