2020-01-05 20:43:07 +01:00
|
|
|
package eu.kanade.tachiyomi.source
|
|
|
|
|
|
|
|
import eu.kanade.tachiyomi.source.model.Page
|
|
|
|
import eu.kanade.tachiyomi.source.model.SChapter
|
|
|
|
import eu.kanade.tachiyomi.source.model.SManga
|
2023-03-05 16:16:19 +01:00
|
|
|
import eu.kanade.tachiyomi.util.awaitSingle
|
2020-01-05 20:43:07 +01:00
|
|
|
import rx.Observable
|
|
|
|
|
|
|
|
/**
|
2023-04-22 17:15:45 +02:00
|
|
|
* A basic interface for creating a source. It could be an online source, a local source, etc.
|
2020-01-05 20:43:07 +01:00
|
|
|
*/
|
2022-08-18 20:07:13 +02:00
|
|
|
interface Source {
|
2020-01-05 20:43:07 +01:00
|
|
|
|
|
|
|
/**
|
2023-04-22 17:15:45 +02:00
|
|
|
* ID for the source. Must be unique.
|
2020-01-05 20:43:07 +01:00
|
|
|
*/
|
2022-08-18 20:07:13 +02:00
|
|
|
val id: Long
|
2020-01-05 20:43:07 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Name of the source.
|
|
|
|
*/
|
2022-08-18 20:07:13 +02:00
|
|
|
val name: String
|
2020-10-26 15:52:28 +01:00
|
|
|
|
2022-08-18 20:07:13 +02:00
|
|
|
val lang: String
|
2020-10-26 15:52:28 +01:00
|
|
|
get() = ""
|
2020-01-05 20:43:07 +01:00
|
|
|
|
2023-08-26 16:30:26 +02:00
|
|
|
/**
|
|
|
|
* Get the updated details for a manga.
|
|
|
|
*
|
|
|
|
* @param manga the manga to update.
|
|
|
|
*/
|
|
|
|
@Suppress("DEPRECATION")
|
|
|
|
suspend fun getMangaDetails(manga: SManga): SManga {
|
|
|
|
return fetchMangaDetails(manga).awaitSingle()
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get all the available chapters for a manga.
|
|
|
|
*
|
|
|
|
* @param manga the manga to update.
|
|
|
|
*/
|
|
|
|
@Suppress("DEPRECATION")
|
|
|
|
suspend fun getChapterList(manga: SManga): List<SChapter> {
|
|
|
|
return fetchChapterList(manga).awaitSingle()
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the list of pages a chapter has. Pages should be returned
|
|
|
|
* in the expected order; the index is ignored.
|
|
|
|
*
|
|
|
|
* @param chapter the chapter.
|
|
|
|
*/
|
|
|
|
@Suppress("DEPRECATION")
|
|
|
|
suspend fun getPageList(chapter: SChapter): List<Page> {
|
|
|
|
return fetchPageList(chapter).awaitSingle()
|
|
|
|
}
|
|
|
|
|
2020-01-05 20:43:07 +01:00
|
|
|
/**
|
|
|
|
* Returns an observable with the updated details for a manga.
|
|
|
|
*
|
|
|
|
* @param manga the manga to update.
|
|
|
|
*/
|
2021-11-28 21:27:21 +01:00
|
|
|
@Deprecated(
|
2023-08-26 16:30:26 +02:00
|
|
|
"Use the non-RxJava API instead",
|
2022-04-08 22:44:23 +02:00
|
|
|
ReplaceWith("getMangaDetails"),
|
2021-11-28 21:27:21 +01:00
|
|
|
)
|
2023-09-02 05:02:18 +02:00
|
|
|
fun fetchMangaDetails(manga: SManga): Observable<SManga> = throw IllegalStateException(
|
|
|
|
"Not used",
|
|
|
|
)
|
2020-01-05 20:43:07 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an observable with all the available chapters for a manga.
|
|
|
|
*
|
|
|
|
* @param manga the manga to update.
|
|
|
|
*/
|
2021-11-28 21:27:21 +01:00
|
|
|
@Deprecated(
|
2023-08-26 16:30:26 +02:00
|
|
|
"Use the non-RxJava API instead",
|
2022-04-08 22:44:23 +02:00
|
|
|
ReplaceWith("getChapterList"),
|
2021-11-28 21:27:21 +01:00
|
|
|
)
|
2023-09-02 05:02:18 +02:00
|
|
|
fun fetchChapterList(manga: SManga): Observable<List<SChapter>> = throw IllegalStateException(
|
|
|
|
"Not used",
|
|
|
|
)
|
2020-01-05 20:43:07 +01:00
|
|
|
|
|
|
|
/**
|
2023-04-22 17:15:45 +02:00
|
|
|
* Returns an observable with the list of pages a chapter has. Pages should be returned
|
|
|
|
* in the expected order; the index is ignored.
|
2020-01-05 20:43:07 +01:00
|
|
|
*
|
|
|
|
* @param chapter the chapter.
|
|
|
|
*/
|
2021-11-28 21:27:21 +01:00
|
|
|
@Deprecated(
|
2023-08-26 16:30:26 +02:00
|
|
|
"Use the non-RxJava API instead",
|
2022-04-08 22:44:23 +02:00
|
|
|
ReplaceWith("getPageList"),
|
2021-11-28 21:27:21 +01:00
|
|
|
)
|
2021-11-19 22:42:19 +01:00
|
|
|
fun fetchPageList(chapter: SChapter): Observable<List<Page>> = Observable.empty()
|
2020-02-27 00:03:34 +01:00
|
|
|
}
|