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 { Single.fromCallable {
db.getFlatMetadataForManga(mangaId).executeAsBlocking() db.getFlatMetadataForManga(mangaId).executeAsBlocking()
}.map { }.map {
if (it != null) it.raise(metaClass) it?.raise(metaClass) ?: newMetaInstance()
else newMetaInstance()
} }
} else { } else {
Single.just(newMetaInstance()) 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.isLewdSource() = (this is LewdSource<*, *> || (this is EnhancedHttpSource && this.enhancedSource is LewdSource<*, *>))
fun Source.getLewdSource(): LewdSource<*, *>? { fun Source.getLewdSource(): LewdSource<*, *>? {
return if (!this.isLewdSource()) { return when {
null !this.isLewdSource() -> null
} else if (this is LewdSource<*, *>) { this is LewdSource<*, *> -> this
this this is EnhancedHttpSource && this.enhancedSource is LewdSource<*, *> -> this.enhancedSource
} else if (this is EnhancedHttpSource && this.enhancedSource is LewdSource<*, *>) { else -> null
this.enhancedSource
} else {
null
} }
} }
} }

View File

@ -154,9 +154,9 @@ class EHentaiSearchMetadata : RaisedSearchMetadata() {
pathSegments.filterNot(String::isNullOrBlank) 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] splitGalleryUrl(url)[2]
fun normalizeUrl(url: String) = fun normalizeUrl(url: String) =

View File

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

View File

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