Move metaproviders to library (#1541)

* Move metaproviders to library

So that providers can extend them when using the library dependency.

* Remove gson
This commit is contained in:
Luna712
2025-02-16 10:46:48 -07:00
committed by GitHub
parent 157a02e6af
commit 0b94f76627
6 changed files with 13 additions and 7 deletions

View File

@ -205,7 +205,6 @@ dependencies {
implementation(libs.quickjs)
implementation(libs.fuzzywuzzy) // Library/Ext Searching with Levenshtein Distance
implementation(libs.safefile) // To Prevent the URI File Fu*kery
implementation(libs.tmdb.java) // TMDB API v3 Wrapper Made with RetroFit
coreLibraryDesugaring(libs.desugar.jdk.libs.nio) // NIO Flavor Needed for NewPipeExtractor
implementation(libs.conscrypt.android) {
version {

View File

@ -31,6 +31,7 @@ kotlin {
implementation(libs.fuzzywuzzy) // Match Extractors
implementation(libs.rhino) // Run JavaScript
implementation(libs.newpipeextractor)
implementation(libs.tmdb.java) // TMDB API v3 Wrapper Made with RetroFit
}
}
}

View File

@ -1,9 +1,16 @@
package com.lagradost.cloudstream3.metaproviders
import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.APIHolder.apis
import com.lagradost.cloudstream3.APIHolder.getApiFromNameNull
import com.lagradost.cloudstream3.ErrorLoadingException
import com.lagradost.cloudstream3.LoadResponse
import com.lagradost.cloudstream3.MovieLoadResponse
import com.lagradost.cloudstream3.MovieSearchResponse
import com.lagradost.cloudstream3.SearchResponse
import com.lagradost.cloudstream3.SubtitleFile
import com.lagradost.cloudstream3.TvType
import com.lagradost.cloudstream3.amap
import com.lagradost.cloudstream3.mvvm.logError
import com.lagradost.cloudstream3.utils.AppUtils.toJson
import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson

View File

@ -1,9 +1,7 @@
package com.lagradost.cloudstream3.metaproviders
import android.net.Uri
import com.fasterxml.jackson.annotation.JsonAlias
import com.fasterxml.jackson.annotation.JsonProperty
import com.lagradost.cloudstream3.APIHolder
import com.lagradost.cloudstream3.APIHolder.unixTimeMS
import com.lagradost.cloudstream3.Actor
import com.lagradost.cloudstream3.ActorData
@ -33,6 +31,7 @@ import com.lagradost.cloudstream3.newTvSeriesLoadResponse
import com.lagradost.cloudstream3.newTvSeriesSearchResponse
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
import com.lagradost.cloudstream3.utils.AppUtils.toJson
import java.net.URI
import java.text.SimpleDateFormat
import java.util.Locale
import kotlin.math.roundToInt
@ -76,7 +75,7 @@ open class TraktProvider : MainAPI() {
if (mediaType == TvType.Movie) {
return newMovieSearchResponse(
name = media.title!!,
name = media.title ?: "",
url = Data(
type = mediaType,
mediaDetails = media,
@ -87,7 +86,7 @@ open class TraktProvider : MainAPI() {
}
} else {
return newTvSeriesSearchResponse(
name = media.title!!,
name = media.title ?: "",
url = Data(
type = mediaType,
mediaDetails = media,
@ -319,7 +318,7 @@ open class TraktProvider : MainAPI() {
private fun getWidthImageUrl(path: String?, width: String): String? {
if (path == null) return null
if (!path.contains("image.tmdb.org")) return fixPath(path)
val fileName = Uri.parse(path).lastPathSegment ?: return null
val fileName = URI(path).path?.substringAfterLast('/') ?: return null
return "https://image.tmdb.org/t/p/${width}/${fileName}"
}