Minor cleanup

This commit is contained in:
Jobobby04
2022-07-24 15:29:48 -04:00
parent 87d7a47b8e
commit 7c2bbb7c00
3 changed files with 100 additions and 95 deletions
+7 -2
View File
@@ -34,6 +34,11 @@ class GalleryAdder(
enabledLanguages().get() to disabledSources().get().map { it.toLong() }.toSet()
}
private val Pair<Set<String>, Set<Long>>.enabledLangs
get() = first
private val Pair<Set<String>, Set<Long>>.disabledSources
get() = second
private val logger = xLogStack()
fun pickSource(url: String): List<UrlImportableSource> {
@@ -41,7 +46,7 @@ class GalleryAdder(
return sourceManager.getVisibleCatalogueSources()
.mapNotNull { it.getMainSource<UrlImportableSource>() }
.filter {
it.lang in filters.first && it.id !in filters.second && try {
it.lang in filters.enabledLangs && it.id !in filters.disabledSources && try {
it.matchesUri(uri)
} catch (e: Exception) {
false
@@ -73,7 +78,7 @@ class GalleryAdder(
sourceManager.getVisibleCatalogueSources()
.mapNotNull { it.getMainSource<UrlImportableSource>() }
.find {
it.lang in filters.first && it.id !in filters.second && try {
it.lang in filters.enabledLangs && it.id !in filters.disabledSources && try {
it.matchesUri(uri)
} catch (e: Exception) {
false