mirror of
https://github.com/gedoor/legado.git
synced 2024-08-30 09:23:26 +08:00
优化
This commit is contained in:
parent
2ac94f9486
commit
0db6464e8c
@ -46,7 +46,7 @@ object SourceAnalyzer {
|
|||||||
fun jsonToBookSources(inputStream: InputStream): Result<MutableList<BookSource>> {
|
fun jsonToBookSources(inputStream: InputStream): Result<MutableList<BookSource>> {
|
||||||
return kotlin.runCatching {
|
return kotlin.runCatching {
|
||||||
val bookSources = mutableListOf<BookSource>()
|
val bookSources = mutableListOf<BookSource>()
|
||||||
kotlin.runCatching {
|
// kotlin.runCatching {
|
||||||
val items: List<Map<String, Any>> = jsonPath.parse(inputStream).read("$")
|
val items: List<Map<String, Any>> = jsonPath.parse(inputStream).read("$")
|
||||||
for (item in items) {
|
for (item in items) {
|
||||||
val jsonItem = jsonPath.parse(item)
|
val jsonItem = jsonPath.parse(item)
|
||||||
@ -54,13 +54,13 @@ object SourceAnalyzer {
|
|||||||
bookSources.add(it)
|
bookSources.add(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.onFailure {
|
// }.onFailure {
|
||||||
val item: Map<String, Any> = jsonPath.parse(inputStream).read("$")
|
// val item: Map<String, Any> = jsonPath.parse(inputStream).read("$")
|
||||||
val jsonItem = jsonPath.parse(item)
|
// val jsonItem = jsonPath.parse(item)
|
||||||
jsonToBookSource(jsonItem.jsonString()).getOrThrow().let {
|
// jsonToBookSource(jsonItem.jsonString()).getOrThrow().let {
|
||||||
bookSources.add(it)
|
// bookSources.add(it)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
bookSources
|
bookSources
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user