mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
smol cleanup
This commit is contained in:
parent
38f251339d
commit
15f0ba12d1
6 changed files with 142 additions and 14 deletions
|
@ -8,6 +8,7 @@ import com.lagradost.cloudstream3.APIHolder
|
|||
import com.lagradost.cloudstream3.utils.ExtractorApi
|
||||
import com.lagradost.cloudstream3.utils.extractorApis
|
||||
import android.util.Log
|
||||
import com.fasterxml.jackson.annotation.JsonProperty
|
||||
|
||||
const val PLUGIN_TAG = "PluginInstance"
|
||||
|
||||
|
@ -33,7 +34,7 @@ abstract class Plugin {
|
|||
*/
|
||||
fun registerMainAPI(element: MainAPI) {
|
||||
Log.i(PLUGIN_TAG, "Adding ${element.name} (${element.mainUrl}) MainAPI")
|
||||
element.sourcePlugin = this.`__filename`
|
||||
element.sourcePlugin = this.__filename
|
||||
APIHolder.allProviders.add(element)
|
||||
APIHolder.addPluginMapping(element)
|
||||
}
|
||||
|
@ -44,14 +45,14 @@ abstract class Plugin {
|
|||
*/
|
||||
fun registerExtractorAPI(element: ExtractorApi) {
|
||||
Log.i(PLUGIN_TAG, "Adding ${element.name} (${element.mainUrl}) ExtractorApi")
|
||||
element.sourcePlugin = this.`__filename`
|
||||
element.sourcePlugin = this.__filename
|
||||
extractorApis.add(element)
|
||||
}
|
||||
|
||||
class Manifest {
|
||||
var name: String? = null
|
||||
var pluginClassName: String? = null
|
||||
var pluginVersion: Int? = null
|
||||
@JsonProperty("name") var name: String? = null
|
||||
@JsonProperty("pluginClassName") var pluginClassName: String? = null
|
||||
@JsonProperty("version") var version: Int? = null
|
||||
}
|
||||
|
||||
var resources: Resources? = null
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.lagradost.cloudstream3.plugins
|
||||
|
||||
import android.content.Context
|
||||
import dalvik.system.PathClassLoader
|
||||
import com.google.gson.Gson
|
||||
import android.content.res.AssetManager
|
||||
|
@ -237,7 +236,7 @@ object PluginManager {
|
|||
}
|
||||
|
||||
val name: String = manifest.name ?: "NO NAME"
|
||||
val version: Int = manifest.pluginVersion ?: PLUGIN_VERSION_NOT_SET
|
||||
val version: Int = manifest.version ?: PLUGIN_VERSION_NOT_SET
|
||||
val pluginClass: Class<*> =
|
||||
loader.loadClass(manifest.pluginClassName) as Class<out Plugin?>
|
||||
val pluginInstance: Plugin =
|
||||
|
@ -298,8 +297,8 @@ object PluginManager {
|
|||
APIHolder.apis.filter { it -> it.sourcePlugin == plugin.__filename }.forEach {
|
||||
removePluginMapping(it)
|
||||
}
|
||||
APIHolder.allProviders.removeIf { provider: MainAPI -> provider.sourcePlugin == plugin.`__filename` }
|
||||
extractorApis.removeIf { provider: ExtractorApi -> provider.sourcePlugin == plugin.`__filename` }
|
||||
APIHolder.allProviders.removeIf { provider: MainAPI -> provider.sourcePlugin == plugin.__filename }
|
||||
extractorApis.removeIf { provider: ExtractorApi -> provider.sourcePlugin == plugin.__filename }
|
||||
|
||||
classLoaders.values.removeIf { v -> v == plugin}
|
||||
|
||||
|
|
|
@ -62,11 +62,11 @@ data class SitePlugin(
|
|||
// Might be used to go directly to the plugin repo in the future
|
||||
@JsonProperty("repositoryUrl") val repositoryUrl: String?,
|
||||
// These types are yet to be mapped and used, ignore for now
|
||||
@JsonProperty("tvTypes") val tvTypes: List<String>?,
|
||||
@JsonProperty("language") val language: String?,
|
||||
@JsonProperty("iconUrl") val iconUrl: String?,
|
||||
// @JsonProperty("tvTypes") val tvTypes: List<String>?,
|
||||
// @JsonProperty("language") val language: String?,
|
||||
// @JsonProperty("iconUrl") val iconUrl: String?,
|
||||
// Set to true to get an 18+ symbol next to the plugin
|
||||
@JsonProperty("isAdult") val isAdult: Boolean?,
|
||||
@JsonProperty("adult") val adult: Boolean?,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ class PluginAdapter(
|
|||
R.drawable.ic_baseline_delete_outline_24
|
||||
else R.drawable.netflix_download
|
||||
|
||||
itemView.nsfw_marker?.isVisible = metadata.isAdult == true
|
||||
itemView.nsfw_marker?.isVisible = metadata.adult == true
|
||||
itemView.action_button?.setImageResource(drawableInt)
|
||||
|
||||
itemView.action_button?.setOnClickListener {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue