[RU]Newbie -> NewManga (#10653)

* [RU]Newbie -> NewManga

* fix adult

* fix nextPage
This commit is contained in:
e-shl 2022-02-04 15:28:17 +05:00 committed by GitHub
parent 38b95e3913
commit 8c9ae32593
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 13 additions and 5 deletions

View File

@ -3,10 +3,10 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlinx-serialization'
ext {
extName = 'Newbie'
extName = 'NewManga(Newbie)'
pkgNameSuffix = 'ru.newbie'
extClass = '.Newbie'
extVersionCode = 5
extVersionCode = 6
}
dependencies {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 187 KiB

After

Width:  |  Height:  |  Size: 52 KiB

View File

@ -38,7 +38,9 @@ import java.util.Date
import java.util.Locale
class Newbie : HttpSource() {
override val name = "Newbie"
override val name = "NewManga(Newbie)"
override val id: Long = 8033757373676218584
override val baseUrl = "https://newmanga.org"
@ -82,7 +84,7 @@ class Newbie : HttpSource() {
val mangas = page.items.map {
it.toSManga()
}
return MangasPage(mangas, mangas.size == count)
return MangasPage(mangas, mangas.isNotEmpty())
}
private fun LibraryDto.toSManga(): SManga {
@ -160,6 +162,12 @@ class Newbie : HttpSource() {
else -> type
}
}
private fun parseAge(adult: String): String {
return when (adult) {
"" -> "0+"
else -> "$adult+"
}
}
private fun MangaDetDto.toSManga(): SManga {
val ratingValue = DecimalFormat("#,###.##").format(rating * 2).replace(",", ".").toFloat()
@ -185,7 +193,7 @@ class Newbie : HttpSource() {
author = o.author?.name
artist = o.artist?.name
description = o.title.ru + "\n" + ratingStar + " " + ratingValue + "\n" + Jsoup.parse(o.description).text()
genre = genres.joinToString { it.title.ru.capitalize() } + ", " + parseType(type) + ", " + "$adult+"
genre = parseType(type) + ", " + adult?.let { parseAge(it) } + ", " + genres.joinToString { it.title.ru.capitalize() }
status = parseStatus(o.status)
}
}