|
@@ -118,6 +118,14 @@ data class BookSource(
|
|
|
|
|
|
|
|
fun getContentRule() = ruleContent ?: ContentRule()
|
|
fun getContentRule() = ruleContent ?: ContentRule()
|
|
|
|
|
|
|
|
|
|
+ fun getDisPlayNameGroup(): String {
|
|
|
|
|
+ return if (bookSourceGroup.isNullOrBlank()) {
|
|
|
|
|
+ bookSourceName
|
|
|
|
|
+ } else {
|
|
|
|
|
+ String.format("%s (%s)", bookSourceName, bookSourceGroup)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
fun addGroup(groups: String): BookSource {
|
|
fun addGroup(groups: String): BookSource {
|
|
|
bookSourceGroup?.splitNotBlank(AppPattern.splitGroupRegex)?.toHashSet()?.let {
|
|
bookSourceGroup?.splitNotBlank(AppPattern.splitGroupRegex)?.toHashSet()?.let {
|
|
|
it.addAll(groups.splitNotBlank(AppPattern.splitGroupRegex))
|
|
it.addAll(groups.splitNotBlank(AppPattern.splitGroupRegex))
|
|
@@ -137,7 +145,7 @@ data class BookSource(
|
|
|
|
|
|
|
|
fun hasGroup(group: String): Boolean {
|
|
fun hasGroup(group: String): Boolean {
|
|
|
bookSourceGroup?.splitNotBlank(AppPattern.splitGroupRegex)?.toHashSet()?.let {
|
|
bookSourceGroup?.splitNotBlank(AppPattern.splitGroupRegex)?.toHashSet()?.let {
|
|
|
- return it.indexOf(group) != -1
|
|
|
|
|
|
|
+ return it.indexOf(group) != -1
|
|
|
}
|
|
}
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
@@ -148,28 +156,28 @@ data class BookSource(
|
|
|
|
|
|
|
|
fun getInvalidGroupNames(): String {
|
|
fun getInvalidGroupNames(): String {
|
|
|
return bookSourceGroup?.splitNotBlank(AppPattern.splitGroupRegex)?.toHashSet()?.filter {
|
|
return bookSourceGroup?.splitNotBlank(AppPattern.splitGroupRegex)?.toHashSet()?.filter {
|
|
|
- "失效" in it
|
|
|
|
|
|
|
+ "失效" in it
|
|
|
}?.joinToString() ?: ""
|
|
}?.joinToString() ?: ""
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
fun equal(source: BookSource) =
|
|
fun equal(source: BookSource) =
|
|
|
equal(bookSourceName, source.bookSourceName)
|
|
equal(bookSourceName, source.bookSourceName)
|
|
|
- && equal(bookSourceUrl, source.bookSourceUrl)
|
|
|
|
|
- && equal(bookSourceGroup, source.bookSourceGroup)
|
|
|
|
|
- && bookSourceType == source.bookSourceType
|
|
|
|
|
- && equal(bookUrlPattern, source.bookUrlPattern)
|
|
|
|
|
- && equal(bookSourceComment, source.bookSourceComment)
|
|
|
|
|
- && enabled == source.enabled
|
|
|
|
|
- && enabledExplore == source.enabledExplore
|
|
|
|
|
- && equal(header, source.header)
|
|
|
|
|
- && loginUrl == source.loginUrl
|
|
|
|
|
- && equal(exploreUrl, source.exploreUrl)
|
|
|
|
|
- && equal(searchUrl, source.searchUrl)
|
|
|
|
|
- && getSearchRule() == source.getSearchRule()
|
|
|
|
|
- && getExploreRule() == source.getExploreRule()
|
|
|
|
|
- && getBookInfoRule() == source.getBookInfoRule()
|
|
|
|
|
- && getTocRule() == source.getTocRule()
|
|
|
|
|
- && getContentRule() == source.getContentRule()
|
|
|
|
|
|
|
+ && equal(bookSourceUrl, source.bookSourceUrl)
|
|
|
|
|
+ && equal(bookSourceGroup, source.bookSourceGroup)
|
|
|
|
|
+ && bookSourceType == source.bookSourceType
|
|
|
|
|
+ && equal(bookUrlPattern, source.bookUrlPattern)
|
|
|
|
|
+ && equal(bookSourceComment, source.bookSourceComment)
|
|
|
|
|
+ && enabled == source.enabled
|
|
|
|
|
+ && enabledExplore == source.enabledExplore
|
|
|
|
|
+ && equal(header, source.header)
|
|
|
|
|
+ && loginUrl == source.loginUrl
|
|
|
|
|
+ && equal(exploreUrl, source.exploreUrl)
|
|
|
|
|
+ && equal(searchUrl, source.searchUrl)
|
|
|
|
|
+ && getSearchRule() == source.getSearchRule()
|
|
|
|
|
+ && getExploreRule() == source.getExploreRule()
|
|
|
|
|
+ && getBookInfoRule() == source.getBookInfoRule()
|
|
|
|
|
+ && getTocRule() == source.getTocRule()
|
|
|
|
|
+ && getContentRule() == source.getContentRule()
|
|
|
|
|
|
|
|
private fun equal(a: String?, b: String?) = a == b || (a.isNullOrEmpty() && b.isNullOrEmpty())
|
|
private fun equal(a: String?, b: String?) = a == b || (a.isNullOrEmpty() && b.isNullOrEmpty())
|
|
|
|
|
|