mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-11-03 23:58:55 +01:00 
			
		
		
		
	Fix NHentai and PervEden sources
Version bump to v6.1.2
This commit is contained in:
		@@ -44,8 +44,8 @@ android {
 | 
			
		||||
        minSdkVersion 16
 | 
			
		||||
        targetSdkVersion 25
 | 
			
		||||
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
 | 
			
		||||
        versionCode 6101
 | 
			
		||||
        versionName "v6.1.1-EH"
 | 
			
		||||
        versionCode 6102
 | 
			
		||||
        versionName "v6.1.2-EH"
 | 
			
		||||
 | 
			
		||||
        buildConfigField "String", "COMMIT_COUNT", "\"${getCommitCount()}\""
 | 
			
		||||
        buildConfigField "String", "COMMIT_SHA", "\"${getGitSha()}\""
 | 
			
		||||
 
 | 
			
		||||
@@ -116,7 +116,7 @@ class NHentai(context: Context) : HttpSource() {
 | 
			
		||||
    fun rawParseGallery(obj: JsonObject) = realmTrans { realm ->
 | 
			
		||||
        val nhId = obj.get("id").asLong
 | 
			
		||||
 | 
			
		||||
        (realm.loadNhentai(nhId)
 | 
			
		||||
        realm.copyFromRealm((realm.loadNhentai(nhId)
 | 
			
		||||
                ?: realm.createUUIDObj(NHentaiMetadata::class.java)).apply {
 | 
			
		||||
            this.nhId = nhId
 | 
			
		||||
 | 
			
		||||
@@ -156,7 +156,7 @@ class NHentai(context: Context) : HttpSource() {
 | 
			
		||||
                if(it.first != null && it.second != null)
 | 
			
		||||
                    tags.add(Tag(it.first!!, it.second!!, false))
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        })
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fun parseGallery(obj: JsonObject) = rawParseGallery(obj).let {
 | 
			
		||||
@@ -167,18 +167,16 @@ class NHentai(context: Context) : HttpSource() {
 | 
			
		||||
 | 
			
		||||
    fun lazyLoadMetadata(url: String) =
 | 
			
		||||
            defRealm { realm ->
 | 
			
		||||
                realm.loadNhentaiAsync(NHentaiMetadata.nhIdFromUrl(url))
 | 
			
		||||
                        .flatMap {
 | 
			
		||||
                            if(it == null)
 | 
			
		||||
                                client.newCall(urlToDetailsRequest(url))
 | 
			
		||||
                                        .asObservableSuccess()
 | 
			
		||||
                                        .map {
 | 
			
		||||
                                            rawParseGallery(jsonParser.parse(it.body()!!.string())
 | 
			
		||||
                                                    .asJsonObject)
 | 
			
		||||
                                        }.first()
 | 
			
		||||
                            else
 | 
			
		||||
                                Observable.just(it)
 | 
			
		||||
                        }.map { realm.copyFromRealm(it) }
 | 
			
		||||
                val meta = realm.loadNhentai(NHentaiMetadata.nhIdFromUrl(url))
 | 
			
		||||
                if(meta == null)
 | 
			
		||||
                    client.newCall(urlToDetailsRequest(url))
 | 
			
		||||
                            .asObservableSuccess()
 | 
			
		||||
                            .map {
 | 
			
		||||
                                rawParseGallery(jsonParser.parse(it.body()!!.string())
 | 
			
		||||
                                        .asJsonObject)
 | 
			
		||||
                            }.first()
 | 
			
		||||
                else
 | 
			
		||||
                    Observable.just(realm.copyFromRealm(meta))
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
    override fun fetchChapterList(manga: SManga)
 | 
			
		||||
 
 | 
			
		||||
@@ -112,7 +112,7 @@ fun PervEdenGalleryMetadata.copyTo(manga: SManga) {
 | 
			
		||||
    }
 | 
			
		||||
    if(altTitles.isNotEmpty())
 | 
			
		||||
        titleDesc += "Alternate Titles: \n" + altTitles.map {
 | 
			
		||||
            "▪ $it"
 | 
			
		||||
            "▪ ${it.title}"
 | 
			
		||||
        }.joinToString(separator = "\n", postfix = "\n")
 | 
			
		||||
 | 
			
		||||
    val detailsDesc = StringBuilder()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user