fix sorting for boredom society (#683)

This commit is contained in:
Carlos 2018-12-25 20:03:23 -05:00 committed by GitHub
parent bac1926e29
commit 6f35fc4c60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 5 additions and 4 deletions

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: Boredom Society'
pkgNameSuffix = 'en.boredomsociety'
extClass = '.BoredomSociety'
extVersionCode = 1
extVersionCode = 2
libVersion = '1.2'
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -63,7 +63,7 @@ class BoredomSociety : ParsedHttpSource() {
override fun latestUpdatesParse(response: Response): MangasPage {
val jsonArray = getJsonArray(response)
val sortedJson = jsonArray.sortedBy { it["last_updated"].long }
val sortedJson = jsonArray.sortedBy { it["last_updated"].long }.asReversed()
val list = parseData(sortedJson)
return MangasPage(list, false)
}
@ -74,7 +74,7 @@ class BoredomSociety : ParsedHttpSource() {
}
private fun parseData(jsonArray: List<JsonElement>): List<SManga> {
var mutableList = mutableListOf<SManga>()
val mutableList = mutableListOf<SManga>()
jsonArray.forEach { json ->
val manga = SManga.create()
manga.url = MANGA_URL + json["id"].string
@ -92,7 +92,6 @@ class BoredomSociety : ParsedHttpSource() {
private fun parseChapter(jsonElement: JsonElement): SChapter {
val sChapter = SChapter.create()
sChapter.url = CHAPTER_URL + jsonElement["id"].string
sChapter.date_upload = jsonElement["creation_timestamp"].long * 1000
val chapterName = mutableListOf<String>()
if (!jsonElement["chapter_name"].string.startsWith("Chapter", true)) {
@ -105,6 +104,7 @@ class BoredomSociety : ParsedHttpSource() {
}
chapterName.add(jsonElement["chapter_name"].string)
sChapter.name = cleanString(chapterName.joinToString(" "))
sChapter.date_upload = jsonElement["creation_timestamp"].long * 1000
return sChapter
}
@ -148,6 +148,7 @@ class BoredomSociety : ParsedHttpSource() {
json["chapters"].asJsonArray.forEach { it ->
mutableChapters.add(parseChapter(it))
}
mutableChapters.reverse()
return mutableChapters
}