Cleanup
This commit is contained in:
parent
bcd36c8fad
commit
eeb0f76cce
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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) =
|
||||
|
@ -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) =
|
||||
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user