Add example template

This commit is contained in:
Jace 2022-08-23 11:26:04 +08:00
parent ca5ed299dc
commit 8a1039db8e
4 changed files with 86 additions and 0 deletions

26
Example/build.gradle.kts Normal file
View file

@ -0,0 +1,26 @@
// use an integer for version numbers
version = 1
cloudstream {
// All of these properties are optional, you can safely remove them
description = ""
authors = listOf("Jace")
/**
* Status int as the following:
* 0: Down
* 1: Ok
* 2: Slow
* 3: Beta only
* */
status = 1 // will be 3 if unspecified
// List of video source types. Users are able to filter for extensions in a given category.
// You can find a list of avaliable types here:
// https://recloudstream.github.io/cloudstream/html/app/com.lagradost.cloudstream3/-tv-type/index.html
tvTypes = listOf("NSFW")
iconUrl = "https://www.google.com/s2/favicons?domain=javfree.sh&sz=%size%"
}

View file

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.lagradost"/>

View file

@ -0,0 +1,45 @@
package com.jacekun
import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.app
import com.lagradost.cloudstream3.mvvm.logError
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.loadExtractor
import org.jsoup.Jsoup
class Example : MainAPI() {
private val globalTvType = TvType.Movie
override var name = "Example"
override var mainUrl = "https://"
override val supportedTypes: Set<TvType> get() = setOf(TvType.NSFW)
override val hasDownloadSupport: Boolean get() = false
override val hasMainPage: Boolean get() = true
override val hasQuickSearch: Boolean get() = false
override suspend fun getMainPage(
page: Int,
request: MainPageRequest
): HomePageResponse {
throw NotImplementedError()
}
override suspend fun search(query: String): List<SearchResponse> {
throw NotImplementedError()
}
override suspend fun load(url: String): LoadResponse {
throw NotImplementedError()
}
override suspend fun loadLinks(
data: String,
isCasting: Boolean,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
): Boolean {
throw NotImplementedError()
}
}

View file

@ -0,0 +1,13 @@
package com.jacekun
import com.lagradost.cloudstream3.plugins.CloudstreamPlugin
import com.lagradost.cloudstream3.plugins.Plugin
import android.content.Context
@CloudstreamPlugin
class ExamplePlugin: Plugin() {
override fun load(context: Context) {
// All providers should be added in this manner. Please don't edit the providers list directly.
registerMainAPI(Example())
}
}