mirror of
https://github.com/recloudstream/cloudstream.git
synced 2025-05-17 11:15:54 +08:00
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:
@ -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 {
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
@ -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}"
|
||||
}
|
||||
|
Reference in New Issue
Block a user