This commit is contained in:
Jobobby04 2020-08-14 18:28:02 -04:00
parent bcd36c8fad
commit eeb0f76cce
4 changed files with 8 additions and 15 deletions

View File

@ -55,8 +55,7 @@ interface LewdSource<M : RaisedSearchMetadata, I> : CatalogueSource {
Single.fromCallable {
db.getFlatMetadataForManga(mangaId).executeAsBlocking()
}.map {
if (it != null) it.raise(metaClass)
else newMetaInstance()
it?.raise(metaClass) ?: newMetaInstance()
}
} else {
Single.just(newMetaInstance())
@ -115,14 +114,11 @@ interface LewdSource<M : RaisedSearchMetadata, I> : CatalogueSource {
fun Source.isLewdSource() = (this is LewdSource<*, *> || (this is EnhancedHttpSource && this.enhancedSource is LewdSource<*, *>))
fun Source.getLewdSource(): LewdSource<*, *>? {
return if (!this.isLewdSource()) {
null
} else if (this is LewdSource<*, *>) {
this
} else if (this is EnhancedHttpSource && this.enhancedSource is LewdSource<*, *>) {
this.enhancedSource
} else {
null
return when {
!this.isLewdSource() -> null
this is LewdSource<*, *> -> this
this is EnhancedHttpSource && this.enhancedSource is LewdSource<*, *> -> this.enhancedSource
else -> null
}
}
}

View File

@ -154,9 +154,9 @@ class EHentaiSearchMetadata : RaisedSearchMetadata() {
pathSegments.filterNot(String::isNullOrBlank)
}
fun galleryId(url: String) = splitGalleryUrl(url)[1]
fun galleryId(url: String): String = splitGalleryUrl(url)[1]
fun galleryToken(url: String) =
fun galleryToken(url: String): String =
splitGalleryUrl(url)[2]
fun normalizeUrl(url: String) =

View File

@ -120,7 +120,6 @@ class HitomiSearchMetadata : RaisedSearchMetadata() {
const val TAG_TYPE_DEFAULT = 0
const val LTN_BASE_URL = "https://ltn.hitomi.la"
const val BASE_URL = "https://hitomi.la"
fun hlIdFromUrl(url: String) =

View File

@ -115,8 +115,6 @@ class TsuminoSearchMetadata : RaisedSearchMetadata() {
fun tmIdFromUrl(url: String) =
Uri.parse(url).lastPathSegment
fun mangaUrlFromId(id: String) = "/Book/Info/$id"
fun thumbUrlFromId(id: String) = "/thumbs/$id/1"
}
}