Added Url intents for DynastyScans and Kuaikanmanhua (#6822)
* Added Url intents for KKMH * Added Url intents for Dynasty Scans
This commit is contained in:
parent
60693e465c
commit
b7110681db
|
@ -1,2 +1,39 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest package="eu.kanade.tachiyomi.extension" />
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="eu.kanade.tachiyomi.extension">
|
||||||
|
<application>
|
||||||
|
<activity
|
||||||
|
android:name=".en.dynasty.DynastyUrlActivity"
|
||||||
|
android:excludeFromRecents="true"
|
||||||
|
android:theme="@android:style/Theme.NoDisplay">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
|
||||||
|
<data
|
||||||
|
android:host="*dynasty-scans.com"
|
||||||
|
android:pathPattern="/anthologies/..*"
|
||||||
|
android:scheme="https" />
|
||||||
|
<data
|
||||||
|
android:host="*dynasty-scans.com"
|
||||||
|
android:pathPattern="/chapters/..*"
|
||||||
|
android:scheme="https" />
|
||||||
|
<data
|
||||||
|
android:host="*dynasty-scans.com"
|
||||||
|
android:pathPattern="/doujins/..*"
|
||||||
|
android:scheme="https" />
|
||||||
|
<data
|
||||||
|
android:host="*dynasty-scans.com"
|
||||||
|
android:pathPattern="/issues/..*"
|
||||||
|
android:scheme="https" />
|
||||||
|
<data
|
||||||
|
android:host="*dynasty-scans.com"
|
||||||
|
android:pathPattern="/series/..*"
|
||||||
|
android:scheme="https" />
|
||||||
|
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
</application>
|
||||||
|
</manifest>
|
|
@ -5,7 +5,7 @@ ext {
|
||||||
extName = 'Dynasty'
|
extName = 'Dynasty'
|
||||||
pkgNameSuffix = 'en.dynasty'
|
pkgNameSuffix = 'en.dynasty'
|
||||||
extClass = '.DynastyFactory'
|
extClass = '.DynastyFactory'
|
||||||
extVersionCode = 12
|
extVersionCode = 13
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@ class DynastyAnthologies : DynastyScans() {
|
||||||
|
|
||||||
override val name = "Dynasty-Anthologies"
|
override val name = "Dynasty-Anthologies"
|
||||||
|
|
||||||
|
override val searchPrefix = "anthologies"
|
||||||
|
|
||||||
override fun popularMangaInitialUrl() = "$baseUrl/anthologies?view=cover"
|
override fun popularMangaInitialUrl() = "$baseUrl/anthologies?view=cover"
|
||||||
|
|
||||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||||
|
|
|
@ -12,6 +12,7 @@ import org.jsoup.nodes.Element
|
||||||
|
|
||||||
class DynastyChapters : DynastyScans() {
|
class DynastyChapters : DynastyScans() {
|
||||||
override val name = "Dynasty-Chapters"
|
override val name = "Dynasty-Chapters"
|
||||||
|
override val searchPrefix = "chapters"
|
||||||
override fun popularMangaInitialUrl() = ""
|
override fun popularMangaInitialUrl() = ""
|
||||||
|
|
||||||
private fun popularMangaInitialUrl(page: Int) = "$baseUrl/search?q=&classes%5B%5D=Chapter&page=$page=$&sort="
|
private fun popularMangaInitialUrl(page: Int) = "$baseUrl/search?q=&classes%5B%5D=Chapter&page=$page=$&sort="
|
||||||
|
|
|
@ -15,6 +15,8 @@ class DynastyDoujins : DynastyScans() {
|
||||||
|
|
||||||
override val name = "Dynasty-Doujins"
|
override val name = "Dynasty-Doujins"
|
||||||
|
|
||||||
|
override val searchPrefix = "doujins"
|
||||||
|
|
||||||
override fun popularMangaInitialUrl() = "$baseUrl/doujins?view=cover"
|
override fun popularMangaInitialUrl() = "$baseUrl/doujins?view=cover"
|
||||||
|
|
||||||
override fun popularMangaFromElement(element: Element): SManga {
|
override fun popularMangaFromElement(element: Element): SManga {
|
||||||
|
|
|
@ -10,6 +10,8 @@ class DynastyIssues : DynastyScans() {
|
||||||
|
|
||||||
override val name = "Dynasty-Issues"
|
override val name = "Dynasty-Issues"
|
||||||
|
|
||||||
|
override val searchPrefix = "issues"
|
||||||
|
|
||||||
override fun popularMangaInitialUrl() = "$baseUrl/issues?view=cover"
|
override fun popularMangaInitialUrl() = "$baseUrl/issues?view=cover"
|
||||||
|
|
||||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||||
|
|
|
@ -2,6 +2,8 @@ package eu.kanade.tachiyomi.extension.en.dynasty
|
||||||
|
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
|
import eu.kanade.tachiyomi.network.asObservableSuccess
|
||||||
|
import eu.kanade.tachiyomi.source.model.FilterList
|
||||||
import eu.kanade.tachiyomi.source.model.MangasPage
|
import eu.kanade.tachiyomi.source.model.MangasPage
|
||||||
import eu.kanade.tachiyomi.source.model.Page
|
import eu.kanade.tachiyomi.source.model.Page
|
||||||
import eu.kanade.tachiyomi.source.model.SChapter
|
import eu.kanade.tachiyomi.source.model.SChapter
|
||||||
|
@ -16,6 +18,7 @@ import org.jsoup.nodes.Element
|
||||||
import org.jsoup.nodes.Node
|
import org.jsoup.nodes.Node
|
||||||
import org.jsoup.nodes.TextNode
|
import org.jsoup.nodes.TextNode
|
||||||
import org.jsoup.select.Elements
|
import org.jsoup.select.Elements
|
||||||
|
import rx.Observable
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.ArrayList
|
import java.util.ArrayList
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
@ -30,6 +33,8 @@ abstract class DynastyScans : ParsedHttpSource() {
|
||||||
|
|
||||||
override val supportsLatest = false
|
override val supportsLatest = false
|
||||||
|
|
||||||
|
open val searchPrefix = ""
|
||||||
|
|
||||||
private var parent: List<Node> = ArrayList()
|
private var parent: List<Node> = ArrayList()
|
||||||
|
|
||||||
private var list = InternalList(ArrayList(), "")
|
private var list = InternalList(ArrayList(), "")
|
||||||
|
@ -58,6 +63,24 @@ abstract class DynastyScans : ParsedHttpSource() {
|
||||||
return MangasPage(mangas, false)
|
return MangasPage(mangas, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
|
||||||
|
if (query.startsWith("manga:")) {
|
||||||
|
return if (query.startsWith("manga:$searchPrefix:")) {
|
||||||
|
val newQuery = query.removePrefix("manga:$searchPrefix:")
|
||||||
|
client.newCall(GET("$baseUrl/$searchPrefix/$newQuery"))
|
||||||
|
.asObservableSuccess()
|
||||||
|
.map { response ->
|
||||||
|
val details = mangaDetailsParse(response)
|
||||||
|
details.url = "/$searchPrefix/$newQuery"
|
||||||
|
MangasPage(listOf(details), false)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return Observable.just(MangasPage(ArrayList<SManga>(0), false))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.fetchSearchManga(page, query, filters)
|
||||||
|
}
|
||||||
|
|
||||||
override fun searchMangaSelector() = "a.name"
|
override fun searchMangaSelector() = "a.name"
|
||||||
|
|
||||||
override fun searchMangaFromElement(element: Element): SManga {
|
override fun searchMangaFromElement(element: Element): SManga {
|
||||||
|
|
|
@ -10,6 +10,8 @@ class DynastySeries : DynastyScans() {
|
||||||
|
|
||||||
override val name = "Dynasty-Series"
|
override val name = "Dynasty-Series"
|
||||||
|
|
||||||
|
override val searchPrefix = "series"
|
||||||
|
|
||||||
override fun popularMangaInitialUrl() = "$baseUrl/series?view=cover"
|
override fun popularMangaInitialUrl() = "$baseUrl/series?view=cover"
|
||||||
|
|
||||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
package eu.kanade.tachiyomi.extension.en.dynasty
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.content.ActivityNotFoundException
|
||||||
|
import android.content.Intent
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.util.Log
|
||||||
|
import kotlin.system.exitProcess
|
||||||
|
|
||||||
|
class DynastyUrlActivity : Activity() {
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
val pathSegments = intent?.data?.pathSegments
|
||||||
|
if (pathSegments != null && pathSegments.size > 1) {
|
||||||
|
val id = pathSegments[1]
|
||||||
|
val mainIntent = Intent().apply {
|
||||||
|
action = "eu.kanade.tachiyomi.SEARCH"
|
||||||
|
putExtra("query", "manga:${pathSegments[0]}:$id")
|
||||||
|
putExtra("filter", packageName)
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
startActivity(mainIntent)
|
||||||
|
} catch (e: ActivityNotFoundException) {
|
||||||
|
Log.e("DynastyUrlActivity", e.toString())
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Log.e("DynastyUrlActivity", "could not parse uri from intent $intent")
|
||||||
|
}
|
||||||
|
|
||||||
|
finish()
|
||||||
|
exitProcess(0)
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,2 +1,27 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest package="eu.kanade.tachiyomi.extension" />
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="eu.kanade.tachiyomi.extension">
|
||||||
|
<application>
|
||||||
|
<activity
|
||||||
|
android:name=".zh.kuaikanmanhua.KuaikanmanhuaUrlActivity"
|
||||||
|
android:excludeFromRecents="true"
|
||||||
|
android:theme="@android:style/Theme.NoDisplay">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
|
||||||
|
<data
|
||||||
|
android:host="m.kuaikanmanhua.com"
|
||||||
|
android:pathPattern="/mobile/..*"
|
||||||
|
android:scheme="https" />
|
||||||
|
<data
|
||||||
|
android:host="*kuaikanmanhua.com"
|
||||||
|
android:pathPattern="/web/topic/..*"
|
||||||
|
android:scheme="https" />
|
||||||
|
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
</application>
|
||||||
|
</manifest>
|
|
@ -5,7 +5,7 @@ ext {
|
||||||
extName = 'Kuaikanmanhua'
|
extName = 'Kuaikanmanhua'
|
||||||
pkgNameSuffix = 'zh.kuaikanmanhua'
|
pkgNameSuffix = 'zh.kuaikanmanhua'
|
||||||
extClass = '.Kuaikanmanhua'
|
extClass = '.Kuaikanmanhua'
|
||||||
extVersionCode = 3
|
extVersionCode = 4
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package eu.kanade.tachiyomi.extension.zh.kuaikanmanhua
|
package eu.kanade.tachiyomi.extension.zh.kuaikanmanhua
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
|
import eu.kanade.tachiyomi.network.asObservableSuccess
|
||||||
import eu.kanade.tachiyomi.source.model.Filter
|
import eu.kanade.tachiyomi.source.model.Filter
|
||||||
import eu.kanade.tachiyomi.source.model.FilterList
|
import eu.kanade.tachiyomi.source.model.FilterList
|
||||||
import eu.kanade.tachiyomi.source.model.MangasPage
|
import eu.kanade.tachiyomi.source.model.MangasPage
|
||||||
|
@ -68,8 +69,23 @@ class Kuaikanmanhua : HttpSource() {
|
||||||
|
|
||||||
// Search
|
// Search
|
||||||
|
|
||||||
|
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
|
||||||
|
if (query.startsWith(TOPIC_ID_SEARCH_PREFIX)) {
|
||||||
|
val new_query = query.removePrefix(TOPIC_ID_SEARCH_PREFIX)
|
||||||
|
return client.newCall(GET("$apiUrl/v1/topics/$new_query"))
|
||||||
|
.asObservableSuccess()
|
||||||
|
.map { response ->
|
||||||
|
val details = mangaDetailsParse(response)
|
||||||
|
details.url = "/web/topic/$new_query"
|
||||||
|
MangasPage(listOf(details), false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.fetchSearchManga(page, query, filters)
|
||||||
|
}
|
||||||
|
|
||||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||||
return if (query.isNotEmpty()) {
|
return if (query.isNotEmpty()) {
|
||||||
|
|
||||||
GET("$apiUrl/v1/search/topic?q=$query&size=18", headers)
|
GET("$apiUrl/v1/search/topic?q=$query&size=18", headers)
|
||||||
} else {
|
} else {
|
||||||
lateinit var genre: String
|
lateinit var genre: String
|
||||||
|
@ -112,6 +128,7 @@ class Kuaikanmanhua : HttpSource() {
|
||||||
val data = JSONObject(response.body!!.string()).getJSONObject("data")
|
val data = JSONObject(response.body!!.string()).getJSONObject("data")
|
||||||
val manga = SManga.create()
|
val manga = SManga.create()
|
||||||
manga.title = data.getString("title")
|
manga.title = data.getString("title")
|
||||||
|
manga.thumbnail_url = data.getString("vertical_image_url")
|
||||||
manga.author = data.getJSONObject("user").getString("nickname")
|
manga.author = data.getJSONObject("user").getString("nickname")
|
||||||
manga.description = data.getString("description")
|
manga.description = data.getString("description")
|
||||||
manga.status = data.getInt("update_status_code")
|
manga.status = data.getInt("update_status_code")
|
||||||
|
@ -227,4 +244,8 @@ class Kuaikanmanhua : HttpSource() {
|
||||||
Filter.Select<String>(displayName, vals.map { it.first }.toTypedArray()) {
|
Filter.Select<String>(displayName, vals.map { it.first }.toTypedArray()) {
|
||||||
fun toUriPart() = vals[state].second
|
fun toUriPart() = vals[state].second
|
||||||
}
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val TOPIC_ID_SEARCH_PREFIX = "topic:"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
package eu.kanade.tachiyomi.extension.zh.kuaikanmanhua
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.content.ActivityNotFoundException
|
||||||
|
import android.content.Intent
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.util.Log
|
||||||
|
import kotlin.system.exitProcess
|
||||||
|
|
||||||
|
class KuaikanmanhuaUrlActivity : Activity() {
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
val host = intent?.data?.host
|
||||||
|
val pathSegments = intent?.data?.pathSegments
|
||||||
|
if (pathSegments != null && pathSegments.size > 1) {
|
||||||
|
val id = when (host) {
|
||||||
|
"m.kuaikanmanhua.com" -> pathSegments[1]
|
||||||
|
else -> pathSegments[2]
|
||||||
|
}
|
||||||
|
val mainIntent = Intent().apply {
|
||||||
|
action = "eu.kanade.tachiyomi.SEARCH"
|
||||||
|
putExtra("query", "${Kuaikanmanhua.TOPIC_ID_SEARCH_PREFIX}$id")
|
||||||
|
putExtra("filter", packageName)
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
startActivity(mainIntent)
|
||||||
|
} catch (e: ActivityNotFoundException) {
|
||||||
|
Log.e("KkmhUrlActivity", e.toString())
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Log.e("KkmhUrlActivity", "could not parse uri from intent $intent")
|
||||||
|
}
|
||||||
|
|
||||||
|
finish()
|
||||||
|
exitProcess(0)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue