3397e694c0
* sync anime lib implementation with 11 * fix wrong api * delete unused classes * adapt to lib 12 * add LICENSE for eu.kanade.tachiyomi * changes for lib 12 * update to lib 12 * update webUI
82 lines
2.4 KiB
Kotlin
82 lines
2.4 KiB
Kotlin
package eu.kanade.tachiyomi.animesource
|
|
|
|
import eu.kanade.tachiyomi.animesource.model.SAnime
|
|
import eu.kanade.tachiyomi.animesource.model.SEpisode
|
|
import eu.kanade.tachiyomi.animesource.model.Video
|
|
import rx.Observable
|
|
|
|
/**
|
|
* A basic interface for creating a source. It could be an online source, a local source, etc...
|
|
*/
|
|
interface AnimeSource {
|
|
|
|
/**
|
|
* Id for the source. Must be unique.
|
|
*/
|
|
val id: Long
|
|
|
|
/**
|
|
* Name of the source.
|
|
*/
|
|
val name: String
|
|
|
|
val lang: String
|
|
get() = ""
|
|
|
|
/**
|
|
* Returns an observable with the updated details for a anime.
|
|
*
|
|
* @param anime the anime to update.
|
|
*/
|
|
// @Deprecated("Use getAnimeDetails instead")
|
|
fun fetchAnimeDetails(anime: SAnime): Observable<SAnime>
|
|
|
|
/**
|
|
* Returns an observable with all the available episodes for an anime.
|
|
*
|
|
* @param anime the anime to update.
|
|
*/
|
|
// @Deprecated("Use getEpisodeList instead")
|
|
fun fetchEpisodeList(anime: SAnime): Observable<List<SEpisode>>
|
|
|
|
/**
|
|
* Returns an observable with a list of video for the episode of an anime.
|
|
*
|
|
* @param episode the episode to get the link for.
|
|
*/
|
|
// @Deprecated("Use getEpisodeList instead")
|
|
fun fetchVideoList(episode: SEpisode): Observable<List<Video>>
|
|
|
|
// /**
|
|
// * [1.x API] Get the updated details for a anime.
|
|
// */
|
|
// @Suppress("DEPRECATION")
|
|
// override suspend fun getAnimeDetails(anime: AnimeInfo): AnimeInfo {
|
|
// val sAnime = anime.toSAnime()
|
|
// val networkAnime = fetchAnimeDetails(sAnime).awaitSingle()
|
|
// sAnime.copyFrom(networkAnime)
|
|
// return sAnime.toAnimeInfo()
|
|
// }
|
|
|
|
// /**
|
|
// * [1.x API] Get all the available episodes for a anime.
|
|
// */
|
|
// @Suppress("DEPRECATION")
|
|
// override suspend fun getEpisodeList(anime: AnimeInfo): List<EpisodeInfo> {
|
|
// return fetchEpisodeList(anime.toSAnime()).awaitSingle()
|
|
// .map { it.toEpisodeInfo() }
|
|
// }
|
|
|
|
// /**
|
|
// * [1.x API] Get a link for the episode of an anime.
|
|
// */
|
|
// @Suppress("DEPRECATION")
|
|
// override suspend fun getEpisodeLink(episode: EpisodeInfo): String {
|
|
// return fetchEpisodeLink(episode.toSEpisode()).awaitSingle()
|
|
// }
|
|
}
|
|
|
|
// fun AnimeSource.icon(): Drawable? = Injekt.get<AnimeExtensionManager>().getAppIconForSource(this)
|
|
|
|
fun AnimeSource.getPreferenceKey(): String = "source_$id"
|