一些优化
This commit is contained in:
4 files changed
+20
-3
No files matched your search
@@ -124,6 +124,16 @@ data class Book(
|
|||||||
var syncTime: Long = 0L
|
var syncTime: Long = 0L
|
||||||
) : Parcelable, BaseBook {
|
) : Parcelable, BaseBook {
|
||||||
|
|
||||||
|
init {
|
||||||
|
kind = kind?.take(1000)
|
||||||
|
intro = intro?.take(5000)
|
||||||
|
customTag = customTag?.take(1000)
|
||||||
|
customIntro = customIntro?.take(5000)
|
||||||
|
remark = remark?.take(1000)
|
||||||
|
latestChapterTitle = latestChapterTitle?.take(200)
|
||||||
|
durChapterTitle = durChapterTitle?.take(200)
|
||||||
|
}
|
||||||
|
|
||||||
@delegate:Transient
|
@delegate:Transient
|
||||||
@delegate:Ignore
|
@delegate:Ignore
|
||||||
@IgnoredOnParcel
|
@IgnoredOnParcel
|
||||||
|
|||||||
@@ -54,6 +54,12 @@ data class SearchBook(
|
|||||||
var respondTime: Int = -1
|
var respondTime: Int = -1
|
||||||
) : Parcelable, BaseBook, Comparable<SearchBook> {
|
) : Parcelable, BaseBook, Comparable<SearchBook> {
|
||||||
|
|
||||||
|
init {
|
||||||
|
kind = kind?.take(1000)
|
||||||
|
intro = intro?.take(5000)
|
||||||
|
latestChapterTitle = latestChapterTitle?.take(200)
|
||||||
|
}
|
||||||
|
|
||||||
@Ignore
|
@Ignore
|
||||||
@IgnoredOnParcel
|
@IgnoredOnParcel
|
||||||
override var infoHtml: String? = null
|
override var infoHtml: String? = null
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ object BookInfo {
|
|||||||
try {
|
try {
|
||||||
analyzeRule.getStringList(infoRule.kind)
|
analyzeRule.getStringList(infoRule.kind)
|
||||||
?.joinToString(",")
|
?.joinToString(",")
|
||||||
|
?.take(1000)
|
||||||
?.let {
|
?.let {
|
||||||
if (it.isNotEmpty()) book.kind = it
|
if (it.isNotEmpty()) book.kind = it
|
||||||
Debug.log(bookSource.bookSourceUrl, "└${it}")
|
Debug.log(bookSource.bookSourceUrl, "└${it}")
|
||||||
@@ -120,7 +121,7 @@ object BookInfo {
|
|||||||
coroutineContext.ensureActive()
|
coroutineContext.ensureActive()
|
||||||
Debug.log(bookSource.bookSourceUrl, "┌获取简介")
|
Debug.log(bookSource.bookSourceUrl, "┌获取简介")
|
||||||
try {
|
try {
|
||||||
HtmlFormatter.format(analyzeRule.getString(infoRule.intro)).let {
|
HtmlFormatter.format(analyzeRule.getString(infoRule.intro)).take(5000).let {
|
||||||
if (it.isNotEmpty()) book.intro = it
|
if (it.isNotEmpty()) book.intro = it
|
||||||
Debug.log(bookSource.bookSourceUrl, "└${it}")
|
Debug.log(bookSource.bookSourceUrl, "└${it}")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ object BookList {
|
|||||||
coroutineContext.ensureActive()
|
coroutineContext.ensureActive()
|
||||||
Debug.log(bookSource.bookSourceUrl, "┌获取分类", log)
|
Debug.log(bookSource.bookSourceUrl, "┌获取分类", log)
|
||||||
try {
|
try {
|
||||||
searchBook.kind = analyzeRule.getStringList(ruleKind)?.joinToString(",")
|
searchBook.kind = analyzeRule.getStringList(ruleKind)?.joinToString(",")?.take(1000)
|
||||||
Debug.log(bookSource.bookSourceUrl, "└${searchBook.kind ?: ""}", log)
|
Debug.log(bookSource.bookSourceUrl, "└${searchBook.kind ?: ""}", log)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
coroutineContext.ensureActive()
|
coroutineContext.ensureActive()
|
||||||
@@ -257,7 +257,7 @@ object BookList {
|
|||||||
coroutineContext.ensureActive()
|
coroutineContext.ensureActive()
|
||||||
Debug.log(bookSource.bookSourceUrl, "┌获取简介", log)
|
Debug.log(bookSource.bookSourceUrl, "┌获取简介", log)
|
||||||
try {
|
try {
|
||||||
searchBook.intro = HtmlFormatter.format(analyzeRule.getString(ruleIntro))
|
searchBook.intro = HtmlFormatter.format(analyzeRule.getString(ruleIntro)).take(5000)
|
||||||
Debug.log(bookSource.bookSourceUrl, "└${searchBook.intro}", log)
|
Debug.log(bookSource.bookSourceUrl, "└${searchBook.intro}", log)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
coroutineContext.ensureActive()
|
coroutineContext.ensureActive()
|
||||||
|
|||||||
Reference in new issue
Block a user