Skip to content

Commit

Permalink
Minor Improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
doGior committed Oct 18, 2024
1 parent 2e6fa61 commit 43a7b42
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 18 deletions.
2 changes: 1 addition & 1 deletion StreamingCommunity/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// use an integer for version numbers
version = 3
version = 4


cloudstream {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,21 @@ import com.lagradost.cloudstream3.HomePageResponse
import com.lagradost.cloudstream3.LoadResponse
import com.lagradost.cloudstream3.LoadResponse.Companion.addImdbId
import com.lagradost.cloudstream3.LoadResponse.Companion.addTMDbId
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
import com.lagradost.cloudstream3.MainAPI
import com.lagradost.cloudstream3.MainPageRequest
import com.lagradost.cloudstream3.MovieLoadResponse
import com.lagradost.cloudstream3.MovieSearchResponse
import com.lagradost.cloudstream3.SubtitleFile
import com.lagradost.cloudstream3.TrailerData
import com.lagradost.cloudstream3.TvSeriesLoadResponse
import com.lagradost.cloudstream3.TvSeriesSearchResponse
import com.lagradost.cloudstream3.TvType
import com.lagradost.cloudstream3.app

import com.lagradost.cloudstream3.mainPageOf
import com.lagradost.cloudstream3.newHomePageResponse
import com.lagradost.cloudstream3.newTvSeriesLoadResponse
import com.lagradost.cloudstream3.utils.AppUtils.parseJson
import com.lagradost.cloudstream3.utils.ExtractorLink

Expand Down Expand Up @@ -186,23 +189,38 @@ class StreamingCommunity : MainAPI() {
val actors = title.mainActors.map { ac -> ActorData(actor = Actor(ac.name)) }
val year = title.releaseDate.substringBefore('-').toIntOrNull()
val related = props.sliders?.get(0)
// Log.d(TAG, "Trailer List: $trailers")
if (title.type == "tv") {
val episodes: List<Episode> = getEpisodes(props)
Log.d(TAG, "Episode List: $episodes")

val tvShow = TvSeriesLoadResponse(
name = title.name,
url = url,
type = TvType.TvSeries,
apiName = this.name,
plot = title.plot,
posterUrl = "https://cdn.$domain/images/" + title.getBackgroundImage(),
tags = tags,
episodes = episodes,
actors = actors,
year = year,
recommendations = related?.titles?.let { searchResponseBuilder(it) }
)
// val tvShow = TvSeriesLoadResponse(
// name = title.name,
// url = url,
// type = TvType.TvSeries,
// apiName = this.name,
// plot = title.plot,
// posterUrl = "https://cdn.$domain/images/" + title.getBackgroundImage(),
// tags = tags,
// episodes = episodes,
// actors = actors,
// year = year,
// recommendations = related?.titles?.let { searchResponseBuilder(it) },
// )
// tvShow.addImdbId(title.imdbId)
// tvShow.addTMDbId(title.tmdbId.toString())
// tvShow.addTrailer(title.trailers.firstOrNull{it.youtubeId != null}?.getYoutubeUrl())
val tvShow = newTvSeriesLoadResponse(title.name, url, TvType.TvSeries, episodes) {
this.posterUrl = "https://cdn.$domain/images/" + title.getBackgroundImage()
this.tags = tags
this.episodes = episodes
this.actors = actors
this.year = year
this.recommendations = related?.titles?.let { searchResponseBuilder(it) }
this.addImdbId(title.imdbId)
this.addTMDbId(title.tmdbId.toString())
this.addTrailer(title.trailers.firstOrNull{it.youtubeId != null}?.getYoutubeUrl())
}
Log.d(TAG, "TV Show: $tvShow")
return tvShow
} else {
Expand All @@ -218,9 +236,11 @@ class StreamingCommunity : MainAPI() {
actors = actors,
year = year,
// comingSoon = title.status == "Post Production",
recommendations = related?.titles?.let { searchResponseBuilder(it) }
recommendations = related?.titles?.let { searchResponseBuilder(it) },
)

movie.addTrailer(title.trailers.firstOrNull{it.youtubeId != null}?.getYoutubeUrl())
movie.addImdbId(title.imdbId)
movie.addTMDbId(title.tmdbId.toString())
Log.d(TAG, "Movie: $movie")
return movie
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ data class Episode(
@JsonProperty("id") val id: Int,
@JsonProperty("number") val number: Int,
@JsonProperty("name") val name: String,
@JsonProperty("plot") val plot: String,
@JsonProperty("plot") val plot: String?,
@JsonProperty("duration") val duration: Int,
@JsonProperty("scws_id") val scwsId: Int,
@JsonProperty("season_id") val seasonId: Int,
Expand Down Expand Up @@ -126,15 +126,18 @@ data class TitleProp(
@JsonProperty("id") val id: Int,
@JsonProperty("name") val name: String,
@JsonProperty("slug") val slug: String,
@JsonProperty("plot") val plot: String,
@JsonProperty("plot") val plot: String?,
@JsonProperty("quality") val quality: String,
@JsonProperty("type") val type: String,
@JsonProperty("score") val score: String,
@JsonProperty("release_date") val releaseDate: String,
@JsonProperty("status") val status: String?,
@JsonProperty("age") val age: Int,
@JsonProperty("tmdb_id") val tmdbId: Int?,
@JsonProperty("imdb_id") val imdbId: String?,
@JsonProperty("seasons_count") val seasonsCount: Int,
@JsonProperty("scws_id") val scwsId: Int?,
@JsonProperty("trailers") val trailers: List<Trailer>,
@JsonProperty("seasons") val seasons: List<Season>,
@JsonProperty("images") val images: List<PosterImage>,
@JsonProperty("genres") val genres: List<Genre>,
Expand All @@ -150,6 +153,19 @@ data class TitleProp(
}
}


data class Trailer(
@JsonProperty("id") val id: Int,
@JsonProperty("name") val name: String,
@JsonProperty("youtube_id") val youtubeId: String?,
@JsonProperty("title_id") val titleId: Int?,
){
fun getYoutubeUrl(): String? {
if(this.youtubeId == null) return null
return "https://www.youtube.com/watch?v=${this.youtubeId}"
}
}

data class Script(
@JsonProperty("video") val videoInfo: SourceFile,
@JsonProperty("streams") val servers: List<Server>,
Expand Down

0 comments on commit 43a7b42

Please sign in to comment.