Allow extensions to open manga or chapter by URL (#9996)

* open manga and chapter using URL

* removing unnnecessary logs

* Resolving comments

* Resolving comments
This commit is contained in:
Joshua Owolabi
2023-10-22 02:44:43 +01:00
committed by GitHub
parent 15423bfc84
commit f84868a264
7 changed files with 125 additions and 13 deletions

View File

@ -289,6 +289,13 @@ abstract class HttpSource : CatalogueSource {
*/
protected abstract fun chapterListParse(response: Response): List<SChapter>
/**
* Parses the response from the site and returns a SChapter Object.
*
* @param response the response from the site.
*/
protected abstract fun chapterPageParse(response: Response): SChapter
/**
* Get the list of pages a chapter has. Pages should be returned
* in the expected order; the index is ignored.

View File

@ -1,6 +1,7 @@
package eu.kanade.tachiyomi.source.online
import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga
/**
@ -11,11 +12,12 @@ import eu.kanade.tachiyomi.source.model.SManga
interface ResolvableSource : Source {
/**
* Whether this source may potentially handle the given URI.
* Returns the UriType of the uri input.
* Returns Unknown if unable to resolve the URI
*
* @since extensions-lib 1.5
*/
fun canResolveUri(uri: String): Boolean
fun getUriType(uri: String): UriType
/**
* Called if canHandleUri is true. Returns the corresponding SManga, if possible.
@ -23,4 +25,17 @@ interface ResolvableSource : Source {
* @since extensions-lib 1.5
*/
suspend fun getManga(uri: String): SManga?
/**
* Called if canHandleUri is true. Returns the corresponding SChapter, if possible.
*
* @since extensions-lib 1.5
*/
suspend fun getChapter(uri: String): SChapter?
}
sealed interface UriType {
object Manga : UriType
object Chapter : UriType
object Unknown : UriType
}