Migrate to version catalog and added provider tests

This commit is contained in:
MrIkso 2025-02-15 01:11:46 +02:00 committed by CakesTwix
parent 7640787db9
commit 9a71bccfcf
Signed by: CakesTwix
GPG key ID: 7B11051D5CE19825
48 changed files with 455 additions and 57 deletions

View file

@ -1,8 +1,11 @@
// use an integer for version numbers
version = 7
dependencies{
implementation("com.google.code.gson:gson:2.9.0")
dependencies {
implementation(libs.gson)
testImplementation(libs.junit)
testImplementation(libs.kotlinx.coroutines.test)
}
cloudstream {

View file

@ -1,5 +1,6 @@
package com.lagradost
import android.util.Log
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.lagradost.cloudstream3.DubStatus
@ -23,6 +24,7 @@ import com.lagradost.cloudstream3.newAnimeSearchResponse
import com.lagradost.cloudstream3.newHomePageResponse
import com.lagradost.cloudstream3.newMovieLoadResponse
import com.lagradost.cloudstream3.toRatingInt
import com.lagradost.cloudstream3.utils.AppUtils.toJson
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.M3u8Helper
import com.lagradost.models.AnimeInfoModel
@ -120,38 +122,36 @@ class AnimeONProvider : MainAPI() {
)).text,
AnimeInfoModel::class.java
)
val showStatus =
with(animeJSON.status.name) {
with(animeJSON.status!!) {
when {
contains("Онґоїнґ") -> ShowStatus.Ongoing
contains("Завершений") -> ShowStatus.Completed
else -> null
contains("ongoing") -> ShowStatus.Ongoing
contains("released") -> ShowStatus.Completed
else -> ShowStatus.Completed
}
}
val tvType =
with(animeJSON.type.name) {
with(animeJSON.type!!) {
when {
contains("ТБ-Серіал") -> TvType.Anime
contains("tv") -> TvType.Anime
contains("OVA") -> TvType.OVA
contains("Спеціальний випуск") -> TvType.OVA
contains("ONA") -> TvType.OVA
contains("Фільм") -> TvType.AnimeMovie
contains("movie") -> TvType.AnimeMovie
else -> TvType.Anime
}
}
val episodes = mutableListOf<Episode>()
// Get all fundub for title and parse only first fundub/player
val fundubs = Gson().fromJson<List<FundubModel>>(app.get("${apiUrl}/player/fundubs/${animeJSON.id}",
val fundubs = Gson().fromJson<List<FundubModel>>(app.get("$mainUrl/api/player/fundubs/${animeJSON.id}",
headers = mapOf(
"Referer" to "https://animeon.club/",
)).text, listFundub)
Gson().fromJson<List<FundubEpisode>>(app.get("${apiUrl}/player/episodes/${fundubs?.get(0)?.player?.get(0)?.id}/${fundubs?.get(0)?.fundub?.id}",
Gson().fromJson<List<FundubEpisode>>(app.get("$mainUrl/api/player/episodes/${fundubs?.get(0)?.player?.get(0)?.id}/${fundubs?.get(0)?.fundub?.id}",
headers = mapOf(
"Referer" to "https://animeon.club/",
)).text, listFundubEpisodes)?.map { epd -> // Episode
@ -172,7 +172,7 @@ class AnimeONProvider : MainAPI() {
) {
this.posterUrl = posterApi.format(animeJSON.poster)
this.engName = animeJSON.titleEn
this.tags = animeJSON.genres.map { it.name }
// this.tags = animeJSON.genres.map { it.name }
this.plot = animeJSON.description
addTrailer(animeJSON.trailer)
this.showStatus = showStatus
@ -212,20 +212,20 @@ class AnimeONProvider : MainAPI() {
callback: (ExtractorLink) -> Unit
): Boolean {
val dataList = data.split(", ")
val fundubs = Gson().fromJson<List<FundubModel>>(app.get("${apiUrl}/player/fundubs/${dataList[0]}",
val fundubs = Gson().fromJson<List<FundubModel>>(app.get("$mainUrl/api/player/fundubs/${dataList[0]}",
headers = mapOf(
"Referer" to "https://animeon.club/",
)).text, listFundub)
if(dataList.size == 2){
fundubs.map { dub ->
Gson().fromJson<List<FundubEpisode>>(app.get("${apiUrl}/player/episodes/${dub.player[0].id}/${dub.fundub.id}",
Gson().fromJson<List<FundubEpisode>>(app.get("$mainUrl/api/player/episodes/${dub.player[0].id}/${dub.fundub.id}",
headers = mapOf(
"Referer" to "https://animeon.club/",
)).text, listFundubEpisodes).filter{ it.episode == dataList[1].toIntOrNull() }.map { epd -> // Episode
M3u8Helper.generateM3u8(
source = "${dub.fundub.name} (${dub.player[0].name})",
streamUrl = getM3U(app.get("${apiUrl}/player/episode/${epd.id}",
streamUrl = getM3U(app.get("$mainUrl/api/player/episode/${epd.id}",
headers = mapOf(
"Referer" to "https://animeon.club/",
)).parsedSafe<FundubVideoUrl>()!!.videoUrl),

View file

@ -16,8 +16,8 @@ class AnimeInfoModel (
@SerializedName("malId") val malId : Int,
@SerializedName("rating") val rating : Double,
@SerializedName("genres") val genres : List<Genres>,
@SerializedName("status") val status : Status,
@SerializedName("type") val type : Type,
@SerializedName("status") val status : String?,
@SerializedName("type") val type : String?,
@SerializedName("player") val player : List<Player>,
)

View file

@ -16,7 +16,7 @@ data class Results (
@SerializedName("image") val image : Image,
@SerializedName("malId") val malId : Int,
@SerializedName("rating") val rating : Double,
@SerializedName("status") val status : Status,
@SerializedName("type") val type : Type,
@SerializedName("status") val status : String?,
@SerializedName("type") val type : String?,
@SerializedName("genres") val genres : List<Genres>
)

View file

@ -28,6 +28,6 @@ data class Result (
@SerializedName("malId") val malId : Int,
@SerializedName("season") val season : Int,
@SerializedName("rating") val rating : Double,
@SerializedName("type") val type : Type,
@SerializedName("status") val status : Status
@SerializedName("type") val type : String?,
@SerializedName("status") val status : String?
)

View file

@ -0,0 +1,14 @@
package com.lagradost
import com.lagradost.cloudstreamtest.ProviderTester
import kotlinx.coroutines.test.runTest
import org.junit.Test
class AnimeONProviderTest {
@Test
fun testProvider() = runTest {
val providerTester = ProviderTester(AnimeONProvider())
providerTester.testAll()
}
}

View file

@ -1,6 +1,10 @@
// use an integer for version numbers
version = 6
dependencies {
testImplementation(libs.junit)
testImplementation(libs.kotlinx.coroutines.test)
}
cloudstream {
language = "uk"

View file

@ -0,0 +1,14 @@
package com.lagradost
import com.lagradost.cloudstreamtest.ProviderTester
import kotlinx.coroutines.test.runTest
import org.junit.Test
class AnimeUAProviderTest {
@Test
fun testProvider() = runTest {
val providerTester = ProviderTester(AnimeUAProvider())
providerTester.testAll()
}
}

View file

@ -1,6 +1,10 @@
// use an integer for version numbers
version = 10
dependencies {
testImplementation(libs.junit)
testImplementation(libs.kotlinx.coroutines.test)
}
cloudstream {
language = "uk"

View file

@ -0,0 +1,14 @@
package com.lagradost
import com.lagradost.cloudstreamtest.ProviderTester
import kotlinx.coroutines.test.runTest
import org.junit.Test
class AnitubeinuaProviderTest {
@Test
fun testProvider() = runTest {
val providerTester = ProviderTester(AnitubeinuaProvider())
providerTester.testAll()
}
}

View file

@ -2,7 +2,10 @@
version = 5
dependencies {
implementation("com.google.code.gson:gson:2.9.0")
implementation(libs.gson)
testImplementation(libs.junit)
testImplementation(libs.kotlinx.coroutines.test)
}
cloudstream {

View file

@ -0,0 +1,14 @@
package com.lagradost
import com.lagradost.cloudstreamtest.ProviderTester
import kotlinx.coroutines.test.runTest
import org.junit.Test
class BambooUAProviderTest {
@Test
fun testProvider() = runTest {
val providerTester = ProviderTester(BambooUAProvider())
providerTester.testAll()
}
}

View file

@ -1,6 +1,10 @@
// use an integer for version numbers
version = 1
dependencies {
testImplementation(libs.junit)
testImplementation(libs.kotlinx.coroutines.test)
}
cloudstream {
language = "uk"

View file

@ -0,0 +1,14 @@
package com.lagradost
import com.lagradost.cloudstreamtest.ProviderTester
import kotlinx.coroutines.test.runTest
import org.junit.Test
class CikavaIdeyaProviderTest {
@Test
fun testProvider() = runTest {
val providerTester = ProviderTester(CikavaIdeyaProvider())
providerTester.testAll()
}
}

View file

@ -1,6 +1,10 @@
// use an integer for version numbers
version = 8
dependencies {
testImplementation(libs.junit)
testImplementation(libs.kotlinx.coroutines.test)
}
cloudstream {
language = "uk"

View file

@ -0,0 +1,14 @@
package com.lagradost
import com.lagradost.cloudstreamtest.ProviderTester
import kotlinx.coroutines.test.runTest
import org.junit.Test
class EneyidaProviderTest {
@Test
fun testProvider() = runTest {
val providerTester = ProviderTester(EneyidaProvider())
providerTester.testAll()
}
}

View file

@ -1,9 +1,10 @@
// use an integer for version numbers
version = 3
// TODO: Need drop this
dependencies{
implementation("com.google.code.gson:gson:2.9.0")
dependencies {
implementation(libs.gson)
testImplementation(libs.junit)
testImplementation(libs.kotlinx.coroutines.test)
}
cloudstream {

View file

@ -0,0 +1,14 @@
package com.lagradost
import com.lagradost.cloudstreamtest.ProviderTester
import kotlinx.coroutines.test.runTest
import org.junit.Test
class HentaiUkrProviderTest {
@Test
fun testProvider() = runTest {
val providerTester = ProviderTester(HentaiUkrProvider())
providerTester.testAll()
}
}

View file

@ -1,6 +1,10 @@
// use an integer for version numbers
version = 5
dependencies {
testImplementation(libs.junit)
testImplementation(libs.kotlinx.coroutines.test)
}
cloudstream {
language = "uk"

View file

@ -0,0 +1,14 @@
package com.lagradost
import com.lagradost.cloudstreamtest.ProviderTester
import kotlinx.coroutines.test.runTest
import org.junit.Test
class KinoTronProviderTest {
@Test
fun testProvider() = runTest {
val providerTester = ProviderTester(KinoTronProvider())
providerTester.testAll()
}
}

View file

@ -1,6 +1,10 @@
// use an integer for version numbers
version = 5
dependencies {
testImplementation(libs.junit)
testImplementation(libs.kotlinx.coroutines.test)
}
cloudstream {
language = "uk"

View file

@ -0,0 +1,14 @@
package com.lagradost
import com.lagradost.cloudstreamtest.ProviderTester
import kotlinx.coroutines.test.runTest
import org.junit.Test
class KinoVezhaProviderTest {
@Test
fun testProvider() = runTest {
val providerTester = ProviderTester(KinoVezhaProvider())
providerTester.testAll()
}
}

View file

@ -1,6 +1,10 @@
// use an integer for version numbers
version = 6
dependencies {
testImplementation(libs.junit)
testImplementation(libs.kotlinx.coroutines.test)
}
cloudstream {
language = "uk"

View file

@ -0,0 +1,14 @@
package com.lagradost
import com.lagradost.cloudstreamtest.ProviderTester
import kotlinx.coroutines.test.runTest
import org.junit.Test
class KlonTVProviderTest {
@Test
fun testProvider() = runTest {
val providerTester = ProviderTester(KlonTVProvider())
providerTester.testAll()
}
}

View file

@ -1,6 +1,10 @@
// use an integer for version numbers
version = 5
dependencies {
testImplementation(libs.junit)
testImplementation(libs.kotlinx.coroutines.test)
}
cloudstream {
language = "uk"

View file

@ -0,0 +1,14 @@
package com.lagradost
import com.lagradost.cloudstreamtest.ProviderTester
import kotlinx.coroutines.test.runTest
import org.junit.Test
class SerialnoProviderTest {
@Test
fun testProvider() = runTest {
val providerTester = ProviderTester(SerialnoProvider())
providerTester.testAll()
}
}

View file

@ -1,8 +1,11 @@
// use an integer for version numbers
version = 3
dependencies{
implementation("com.google.code.gson:gson:2.9.0")
dependencies {
implementation(libs.gson)
testImplementation(libs.junit)
testImplementation(libs.kotlinx.coroutines.test)
}
cloudstream {

View file

@ -0,0 +1,14 @@
package com.lagradost
import com.lagradost.cloudstreamtest.ProviderTester
import kotlinx.coroutines.test.runTest
import org.junit.Test
class TeleportalProviderTest {
@Test
fun testProvider() = runTest {
val providerTester = ProviderTester(TeleportalProvider())
providerTester.testAll()
}
}

View file

@ -2,7 +2,10 @@
version = 5
dependencies {
implementation("com.google.code.gson:gson:2.10.1")
implementation(libs.gson)
testImplementation(libs.junit)
testImplementation(libs.kotlinx.coroutines.test)
}
cloudstream {

View file

@ -0,0 +1,14 @@
package com.lagradost
import com.lagradost.cloudstreamtest.ProviderTester
import kotlinx.coroutines.test.runTest
import org.junit.Test
class UAFlixProviderTest {
@Test
fun testProvider() = runTest {
val providerTester = ProviderTester(UAFlixProvider())
providerTester.testAll()
}
}

View file

@ -2,7 +2,10 @@
version = 10
dependencies {
implementation("com.google.code.gson:gson:2.9.0")
implementation(libs.gson)
testImplementation(libs.junit)
testImplementation(libs.kotlinx.coroutines.test)
}
cloudstream {

View file

@ -0,0 +1,14 @@
package com.lagradost
import com.lagradost.cloudstreamtest.ProviderTester
import kotlinx.coroutines.test.runTest
import org.junit.Test
class UASerialProviderTest {
@Test
fun testProvider() = runTest {
val providerTester = ProviderTester(UASerialProvider("https://uaserial.com", "UASerial"))
providerTester.testAll()
}
}

View file

@ -2,7 +2,10 @@
version = 8
dependencies {
implementation("com.google.code.gson:gson:2.9.0")
implementation(libs.gson)
testImplementation(libs.junit)
testImplementation(libs.kotlinx.coroutines.test)
}
cloudstream {

View file

@ -0,0 +1,14 @@
package com.lagradost
import com.lagradost.cloudstreamtest.ProviderTester
import kotlinx.coroutines.test.runTest
import org.junit.Test
class UASerialsProProviderTest {
@Test
fun testProvider() = runTest {
val providerTester = ProviderTester(UASerialsProProvider())
providerTester.testAll()
}
}

View file

@ -1,6 +1,10 @@
// use an integer for version numbers
version = 1
dependencies {
testImplementation(libs.junit)
testImplementation(libs.kotlinx.coroutines.test)
}
cloudstream {
language = "uk"

View file

@ -0,0 +1,14 @@
package com.lagradost
import com.lagradost.cloudstreamtest.ProviderTester
import kotlinx.coroutines.test.runTest
import org.junit.Test
class UAserialsVipProviderTest {
@Test
fun testProvider() = runTest {
val providerTester = ProviderTester(UAserialsVipProvider())
providerTester.testAll()
}
}

View file

@ -1,6 +1,10 @@
// use an integer for version numbers
version = 4
dependencies {
testImplementation(libs.junit)
testImplementation(libs.kotlinx.coroutines.test)
}
cloudstream {
language = "uk"

View file

@ -0,0 +1,14 @@
package com.lagradost
import com.lagradost.cloudstreamtest.ProviderTester
import kotlinx.coroutines.test.runTest
import org.junit.Test
class UFDubProviderTest {
@Test
fun testProvider() = runTest {
val providerTester = ProviderTester(UFDubProvider())
providerTester.testAll()
}
}

View file

@ -1,6 +1,10 @@
// use an integer for version numbers
version = 11
dependencies {
testImplementation(libs.junit)
testImplementation(libs.kotlinx.coroutines.test)
}
cloudstream {
language = "uk"

View file

@ -0,0 +1,14 @@
package com.lagradost
import com.lagradost.cloudstreamtest.ProviderTester
import kotlinx.coroutines.test.runTest
import org.junit.Test
class UakinoProviderTest {
@Test
fun testProvider() = runTest {
val providerTester = ProviderTester(UakinoProvider())
providerTester.testAll()
}
}

View file

@ -1,8 +1,11 @@
// use an integer for version numbers
version = 10
dependencies{
implementation("com.google.code.gson:gson:2.9.0")
dependencies {
implementation(libs.gson)
testImplementation(libs.junit)
testImplementation(libs.kotlinx.coroutines.test)
}
cloudstream {

View file

@ -0,0 +1,14 @@
package com.lagradost
import com.lagradost.cloudstreamtest.ProviderTester
import kotlinx.coroutines.test.runTest
import org.junit.Test
class UnimayProviderTest {
@Test
fun testProvider() = runTest {
val providerTester = ProviderTester(UnimayProvider())
providerTester.testAll()
}
}

View file

@ -2,7 +2,10 @@
version = 2
dependencies {
implementation("com.google.code.gson:gson:2.9.0")
implementation(libs.gson)
testImplementation(libs.junit)
testImplementation(libs.kotlinx.coroutines.test)
}
cloudstream {

View file

@ -0,0 +1,14 @@
package com.lagradost
import com.lagradost.cloudstreamtest.ProviderTester
import kotlinx.coroutines.test.runTest
import org.junit.Test
class VodneriloProviderTest {
@Test
fun testProvider() = runTest {
val providerTester = ProviderTester(VodneriloProvider())
providerTester.testAll()
}
}

View file

@ -2,26 +2,15 @@ import com.lagradost.cloudstream3.gradle.CloudstreamExtension
import com.android.build.gradle.BaseExtension
buildscript {
repositories {
google()
mavenCentral()
// Shitpack repo which contains our tools and dependencies
maven("https://jitpack.io")
}
dependencies {
classpath("com.android.tools.build:gradle:8.7.3")
classpath("com.github.recloudstream:gradle:-SNAPSHOT")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.0")
classpath(libs.recloudstream.gradle)
}
}
allprojects {
repositories {
google()
mavenCentral()
maven("https://jitpack.io")
}
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin) apply false
}
fun Project.cloudstream(configuration: CloudstreamExtension.() -> Unit) = extensions.getByName<CloudstreamExtension>("cloudstream").configuration()
@ -68,19 +57,34 @@ subprojects {
}
dependencies {
val cloudstream by configurations
val apk by configurations
val implementation by configurations
cloudstream("com.lagradost:cloudstream3:pre-release")
val libs = rootProject.libs
val apkTasks = listOf("deployWithAdb", "build")
val useApk = gradle.startParameter.taskNames.any { taskName ->
apkTasks.any { apkTask ->
taskName.contains(apkTask, ignoreCase = true)
}
}
// If the task is specifically to compile the app then use the stubs, otherwise us the library.
if (useApk) {
// Stubs for all Cloudstream classes
apk(libs.cloudstream3)
} else {
// For running locally
implementation(libs.cloudstreamapi)
}
// these dependencies can include any of those which are added by the app,
// but you dont need to include any of them if you dont need them
// https://github.com/recloudstream/cloudstream/blob/master/app/build.gradle
implementation(kotlin("stdlib")) // adds standard kotlin features, like listOf, mapOf etc
implementation("com.github.Blatzar:NiceHttp:0.4.11") // http library
implementation("org.jsoup:jsoup:1.18.3") // html parser
implementation(libs.nicehttp) // http library
implementation(libs.jsoup) // html parser
}
}
task<Delete>("clean") {
tasks.register<Delete>("clean") {
delete(rootProject.buildDir)
}

28
gradle/libs.versions.toml Normal file
View file

@ -0,0 +1,28 @@
[versions]
android-gradle-plugin = "8.8.0"
cloudstream3 = "pre-release"
cloudstreamapi = "0.1.6"
recloudstream-gradle = "-SNAPSHOT"
gson = "2.9.0"
kotlinx-coroutines-test = "1.10.1"
nicehttp = "0.4.11"
jsoup = "1.18.3"
kotlin = "2.1.10"
junit = "4.13.2"
junitVersion = "1.2.1"
[libraries]
cloudstream3 = { module = "com.lagradost:cloudstream3", version.ref = "cloudstream3" }
cloudstreamapi = { module = "com.github.Blatzar:CloudstreamApi", version.ref = "cloudstreamapi" }
recloudstream-gradle = { module = "com.github.recloudstream:gradle", version.ref = "recloudstream-gradle" }
gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
jsoup = { module = "org.jsoup:jsoup", version.ref = "jsoup" }
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines-test" }
nicehttp = { module = "com.github.Blatzar:NiceHttp", version.ref = "nicehttp" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
[plugins]
android-application = { id = "com.android.application", version.ref = "android-gradle-plugin" }
android-library = { id = "com.android.library", version.ref = "android-gradle-plugin" }
kotlin = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }

View file

@ -1,6 +1,6 @@
#Mon Jan 13 19:56:56 EET 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View file

@ -1,3 +1,20 @@
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
maven("https://jitpack.io")
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven("https://jitpack.io")
}
}
rootProject.name = "CloudstreamPlugins"
// This file sets what projects are included. All new projects should get automatically included unless specified in "disabled" variable.