[RU]Remanga filter only the last non-purchased chapters (#18418)

* [RU]Remanga filter only the last non-purchased chapters

* detect LICENSED when metadata not updated (when update library chapters)

* simplify not paid
This commit is contained in:
Eshlender 2023-10-07 22:30:44 +05:00 committed by GitHub
parent 449f715df0
commit 2377974bd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 13 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'Remanga' extName = 'Remanga'
pkgNameSuffix = 'ru.remanga' pkgNameSuffix = 'ru.remanga'
extClass = '.Remanga' extClass = '.Remanga'
extVersionCode = 81 extVersionCode = 82
} }
dependencies { dependencies {

View File

@ -440,6 +440,9 @@ class Remanga : ConfigurableSource, HttpSource() {
val series = json.decodeFromJsonElement<MangaDetDto>(content) val series = json.decodeFromJsonElement<MangaDetDto>(content)
branches[series.dir] = series.branches branches[series.dir] = series.branches
mangaIDs[series.dir] = series.id mangaIDs[series.dir] = series.id
if (parseStatus(series.status.id) == SManga.LICENSED && series.branches.maxByOrNull { selector(it) }!!.count_chapters == 0) {
throw Exception("Лицензировано - Нет глав")
}
series.branches series.branches
} else { } else {
emptyList() emptyList()
@ -447,19 +450,16 @@ class Remanga : ConfigurableSource, HttpSource() {
} }
private fun filterPaid(tempChaptersList: MutableList<SChapter>): MutableList<SChapter> { private fun filterPaid(tempChaptersList: MutableList<SChapter>): MutableList<SChapter> {
val lastEx = tempChaptersList.find { it.scanlator.equals("exmanga") or it.url.contains("#is_bought") }
return if (!preferences.getBoolean(PAID_PREF, false)) { return if (!preferences.getBoolean(PAID_PREF, false)) {
tempChaptersList.filter { val lastEx = tempChaptersList.find { !it.name.contains("\uD83D\uDCB2") }
!it.name.contains("\uD83D\uDCB2") || if (lastEx != null) { tempChaptersList.filterNot {
( it.name.contains("\uD83D\uDCB2") && if (lastEx != null) {
( val volCor = it.name.substringBefore(
it.name.substringBefore( ". Глава",
". Глава", ).toIntOrNull()!!
).toIntOrNull()!! <= val volLast = lastEx.name.substringBefore(". Глава").toIntOrNull()!!
(lastEx.name.substringBefore(". Глава").toIntOrNull()!!) (volCor > volLast) ||
) && ((volCor == volLast) && (it.chapter_number > lastEx.chapter_number))
(it.chapter_number < lastEx.chapter_number)
)
} else { } else {
false false
} }