mirror of
https://github.com/tachiyomiorg/tachiyomi-extensions-inspector.git
synced 2024-12-26 00:31:49 +01:00
add latest manga
This commit is contained in:
parent
f085f26d10
commit
fade116a02
@ -66,6 +66,10 @@ class Main {
|
|||||||
val sourceId = ctx.pathParam("source_id")
|
val sourceId = ctx.pathParam("source_id")
|
||||||
ctx.json(getPopularManga(sourceId))
|
ctx.json(getPopularManga(sourceId))
|
||||||
}
|
}
|
||||||
|
app.get("/api/v1/source/:source_id/latest") { ctx ->
|
||||||
|
val sourceId = ctx.pathParam("source_id")
|
||||||
|
ctx.json(getLatestManga(sourceId))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package ir.armor.tachidesk.util
|
package ir.armor.tachidesk.util
|
||||||
|
|
||||||
import ir.armor.tachidesk.database.dataclass.MangaDataClass
|
import ir.armor.tachidesk.database.dataclass.MangaDataClass
|
||||||
import ir.armor.tachidesk.database.entity.SourceEntity
|
|
||||||
import ir.armor.tachidesk.database.table.MangaStatus
|
import ir.armor.tachidesk.database.table.MangaStatus
|
||||||
|
|
||||||
fun getPopularManga(sourceId: String): List<MangaDataClass> {
|
fun getPopularManga(sourceId: String): List<MangaDataClass> {
|
||||||
@ -24,3 +23,24 @@ fun getPopularManga(sourceId: String): List<MangaDataClass> {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getLatestManga(sourceId: String): List<MangaDataClass> {
|
||||||
|
val manguasPage = getHttpSource(sourceId.toLong()).fetchLatestUpdates(1).toBlocking().first()
|
||||||
|
return manguasPage.mangas.map {
|
||||||
|
MangaDataClass(
|
||||||
|
sourceId.toLong(),
|
||||||
|
|
||||||
|
it.url,
|
||||||
|
it.title,
|
||||||
|
it.thumbnail_url,
|
||||||
|
|
||||||
|
it.initialized,
|
||||||
|
|
||||||
|
it.artist,
|
||||||
|
it.author,
|
||||||
|
it.description,
|
||||||
|
it.genre,
|
||||||
|
MangaStatus.values().first { that -> it.status == that.status }.name,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user