mirror of
https://github.com/owenlejeune/TVTime.git
synced 2025-11-16 08:40:53 -05:00
migrate tv credits to aggregate credits
This commit is contained in:
@@ -119,7 +119,7 @@ class OnboardingActivity: MonetCompatActivity() {
|
|||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(all = 12.dp)
|
.padding(all = 12.dp)
|
||||||
) {
|
) {
|
||||||
OnboardingPage[pagerState.currentPage].footer.invoke(this@Column)
|
OnboardingPage[pagerState.currentPage].footer.invoke(this)
|
||||||
Row(
|
Row(
|
||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ interface MoviesApi {
|
|||||||
suspend fun getMovieImages(@Path("id") id: Int): Response<ImageCollection>
|
suspend fun getMovieImages(@Path("id") id: Int): Response<ImageCollection>
|
||||||
|
|
||||||
@GET("movie/{id}/credits")
|
@GET("movie/{id}/credits")
|
||||||
suspend fun getCastAndCrew(@Path("id") id: Int): Response<CastAndCrew>
|
suspend fun getCastAndCrew(@Path("id") id: Int): Response<MovieCastAndCrew>
|
||||||
|
|
||||||
@GET("movie/{id}/release_dates")
|
@GET("movie/{id}/release_dates")
|
||||||
suspend fun getReleaseDates(@Path("id") id: Int): Response<MovieReleaseResults>
|
suspend fun getReleaseDates(@Path("id") id: Int): Response<MovieReleaseResults>
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ interface TvApi {
|
|||||||
@GET("tv/{id}/images")
|
@GET("tv/{id}/images")
|
||||||
suspend fun getTvImages(@Path("id") id: Int): Response<ImageCollection>
|
suspend fun getTvImages(@Path("id") id: Int): Response<ImageCollection>
|
||||||
|
|
||||||
@GET("tv/{id}/credits")
|
@GET("tv/{id}/aggregate_credits")
|
||||||
suspend fun getCastAndCrew(@Path("id") id: Int): Response<CastAndCrew>
|
suspend fun getCastAndCrew(@Path("id") id: Int): Response<TvCastAndCrew>
|
||||||
|
|
||||||
@GET("tv/{id}/content_ratings")
|
@GET("tv/{id}/content_ratings")
|
||||||
suspend fun getContentRatings(@Path("id") id: Int): Response<TvContentRatings>
|
suspend fun getContentRatings(@Path("id") id: Int): Response<TvContentRatings>
|
||||||
|
|||||||
@@ -2,7 +2,11 @@ package com.owenlejeune.tvtime.api.tmdb.api.v3.model
|
|||||||
|
|
||||||
import com.google.gson.annotations.SerializedName
|
import com.google.gson.annotations.SerializedName
|
||||||
|
|
||||||
class CastAndCrew(
|
abstract class CastAndCrew<C, R>(
|
||||||
@SerializedName("cast") val cast: List<CastMember>,
|
@SerializedName("cast") val cast: List<C>,
|
||||||
@SerializedName("crew") val crew: List<CrewMember>
|
@SerializedName("crew") val crew: List<R>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
class TvCastAndCrew(cast: List<TvCastMember>, crew: List<TvCrewMember>): CastAndCrew<TvCastMember, TvCrewMember>(cast, crew)
|
||||||
|
|
||||||
|
class MovieCastAndCrew(cast: List<MovieCastMember>, crew: List<MovieCrewMember>): CastAndCrew<MovieCastMember, MovieCrewMember>(cast, crew)
|
||||||
@@ -0,0 +1,128 @@
|
|||||||
|
package com.owenlejeune.tvtime.api.tmdb.api.v3.model
|
||||||
|
|
||||||
|
import com.google.gson.annotations.SerializedName
|
||||||
|
import com.owenlejeune.tvtime.utils.types.Gender
|
||||||
|
|
||||||
|
abstract class CastCrewMember(
|
||||||
|
id: Int,
|
||||||
|
name: String,
|
||||||
|
gender: Gender,
|
||||||
|
profilePath: String?,
|
||||||
|
@SerializedName("adult") val isAdult: Boolean,
|
||||||
|
@SerializedName("known_for_department") val knownForDepartment: String,
|
||||||
|
@SerializedName("original_name") val originalName: String,
|
||||||
|
@SerializedName("popularity") val popularity: Float
|
||||||
|
): Person(id, name, gender, profilePath)
|
||||||
|
|
||||||
|
abstract class CastMember(
|
||||||
|
id: Int,
|
||||||
|
name: String,
|
||||||
|
gender: Gender,
|
||||||
|
profilePath: String?,
|
||||||
|
isAdult: Boolean,
|
||||||
|
knownForDepartment: String,
|
||||||
|
originalName: String,
|
||||||
|
popularity: Float,
|
||||||
|
@SerializedName("order") val order: Int
|
||||||
|
): CastCrewMember(id, name, gender, profilePath, isAdult, knownForDepartment, originalName, popularity)
|
||||||
|
|
||||||
|
class EpisodeCastMember(
|
||||||
|
id: Int,
|
||||||
|
name: String,
|
||||||
|
gender: Gender,
|
||||||
|
profilePath: String?,
|
||||||
|
isAdult: Boolean,
|
||||||
|
knownForDepartment: String,
|
||||||
|
originalName: String,
|
||||||
|
popularity: Float,
|
||||||
|
order: Int,
|
||||||
|
@SerializedName("credit_id") val creditId: String
|
||||||
|
): CastMember(id, name, gender, profilePath, isAdult, knownForDepartment, originalName, popularity, order)
|
||||||
|
|
||||||
|
class TvCastMember(
|
||||||
|
id: Int,
|
||||||
|
name: String,
|
||||||
|
gender: Gender,
|
||||||
|
profilePath: String?,
|
||||||
|
isAdult: Boolean,
|
||||||
|
knownForDepartment: String,
|
||||||
|
originalName: String,
|
||||||
|
popularity: Float,
|
||||||
|
order: Int,
|
||||||
|
@SerializedName("roles") val roles: List<CastCrewRole>,
|
||||||
|
@SerializedName("total_episode_count") val totalEpisodeCount: Int
|
||||||
|
): CastMember(id, name, gender, profilePath, isAdult, knownForDepartment, originalName, popularity, order)
|
||||||
|
|
||||||
|
class MovieCastMember(
|
||||||
|
id: Int,
|
||||||
|
name: String,
|
||||||
|
gender: Gender,
|
||||||
|
profilePath: String?,
|
||||||
|
isAdult: Boolean,
|
||||||
|
knownForDepartment: String,
|
||||||
|
originalName: String,
|
||||||
|
popularity: Float,
|
||||||
|
order: Int,
|
||||||
|
@SerializedName("cast_id") val castId: Int,
|
||||||
|
@SerializedName("character") val character: String,
|
||||||
|
@SerializedName("credit_id") val creditId: String
|
||||||
|
): CastMember(id, name, gender, profilePath, isAdult, knownForDepartment, originalName, popularity, order)
|
||||||
|
|
||||||
|
abstract class CrewMember(
|
||||||
|
id: Int,
|
||||||
|
name: String,
|
||||||
|
gender: Gender,
|
||||||
|
profilePath: String?,
|
||||||
|
isAdult: Boolean,
|
||||||
|
knownForDepartment: String,
|
||||||
|
originalName: String,
|
||||||
|
popularity: Float,
|
||||||
|
@SerializedName("department") val department: String
|
||||||
|
): CastCrewMember(id, name, gender, profilePath, isAdult, knownForDepartment, originalName, popularity)
|
||||||
|
|
||||||
|
class EpisodeCrewMember(
|
||||||
|
id: Int,
|
||||||
|
name: String,
|
||||||
|
gender: Gender,
|
||||||
|
profilePath: String?,
|
||||||
|
isAdult: Boolean,
|
||||||
|
knownForDepartment: String,
|
||||||
|
originalName: String,
|
||||||
|
popularity: Float,
|
||||||
|
department: String,
|
||||||
|
@SerializedName("credit_id") val creditId: String
|
||||||
|
): CrewMember(id, name, gender, profilePath, isAdult, knownForDepartment, originalName, popularity, department)
|
||||||
|
|
||||||
|
class TvCrewMember(
|
||||||
|
id: Int,
|
||||||
|
name: String,
|
||||||
|
gender: Gender,
|
||||||
|
profilePath: String?,
|
||||||
|
isAdult: Boolean,
|
||||||
|
knownForDepartment: String,
|
||||||
|
originalName: String,
|
||||||
|
popularity: Float,
|
||||||
|
department: String,
|
||||||
|
@SerializedName("total_episode_counte") val totalEpisodeCount: Int,
|
||||||
|
@SerializedName("jobs") val jobs: List<CastCrewRole>
|
||||||
|
): CrewMember(id, name, gender, profilePath, isAdult, knownForDepartment, originalName, popularity, department)
|
||||||
|
|
||||||
|
class MovieCrewMember(
|
||||||
|
id: Int,
|
||||||
|
name: String,
|
||||||
|
gender: Gender,
|
||||||
|
profilePath: String?,
|
||||||
|
isAdult: Boolean,
|
||||||
|
knownForDepartment: String,
|
||||||
|
originalName: String,
|
||||||
|
popularity: Float,
|
||||||
|
department: String,
|
||||||
|
@SerializedName("job") val job: String,
|
||||||
|
@SerializedName("credit_id") val creditId: String
|
||||||
|
): CrewMember(id, name, gender, profilePath, isAdult, knownForDepartment, originalName, popularity, department)
|
||||||
|
|
||||||
|
class CastCrewRole(
|
||||||
|
@SerializedName("credit_id") val creditId: String,
|
||||||
|
@SerializedName("character", alternate = ["job"]) val role: String,
|
||||||
|
@SerializedName("episode_count") val episodeCount: Int
|
||||||
|
)
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package com.owenlejeune.tvtime.api.tmdb.api.v3.model
|
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName
|
|
||||||
|
|
||||||
class CastMember(
|
|
||||||
@SerializedName("character") val character: String,
|
|
||||||
@SerializedName("order") val order: Int,
|
|
||||||
@SerializedName("credit_id") val creditId: String,
|
|
||||||
id: Int,
|
|
||||||
name: String,
|
|
||||||
gender: Int,
|
|
||||||
profilePath: String?
|
|
||||||
): Person(id, name, gender, profilePath)
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package com.owenlejeune.tvtime.api.tmdb.api.v3.model
|
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName
|
|
||||||
|
|
||||||
class CrewMember(
|
|
||||||
@SerializedName("department") val department: String,
|
|
||||||
@SerializedName("job") val job: String,
|
|
||||||
@SerializedName("credit_id") val creditId: String,
|
|
||||||
id: Int,
|
|
||||||
name: String,
|
|
||||||
gender: Int,
|
|
||||||
profilePath: String?
|
|
||||||
): Person(id, name, gender, profilePath)
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.owenlejeune.tvtime.api.tmdb.api.v3.model
|
package com.owenlejeune.tvtime.api.tmdb.api.v3.model
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName
|
import com.google.gson.annotations.SerializedName
|
||||||
|
import com.owenlejeune.tvtime.utils.types.Gender
|
||||||
|
|
||||||
class DetailPerson(
|
class DetailPerson(
|
||||||
@SerializedName("birthday") val birthday: String,
|
@SerializedName("birthday") val birthday: String,
|
||||||
@@ -11,6 +12,6 @@ class DetailPerson(
|
|||||||
@SerializedName("adult") val isAdult: Boolean,
|
@SerializedName("adult") val isAdult: Boolean,
|
||||||
id: Int,
|
id: Int,
|
||||||
name: String,
|
name: String,
|
||||||
gender: Int,
|
gender: Gender,
|
||||||
profilePath: String?
|
profilePath: String?
|
||||||
): Person(id, name, gender, profilePath)
|
): Person(id, name, gender, profilePath)
|
||||||
@@ -16,6 +16,6 @@ data class Episode(
|
|||||||
@SerializedName("still_path") val stillPath: String?,
|
@SerializedName("still_path") val stillPath: String?,
|
||||||
@SerializedName("vote_average") val voteAverage: Float,
|
@SerializedName("vote_average") val voteAverage: Float,
|
||||||
@SerializedName("vote_count") val voteCount: Int,
|
@SerializedName("vote_count") val voteCount: Int,
|
||||||
@SerializedName("crew") val crew: List<CrewMember>?,
|
@SerializedName("crew") val crew: List<EpisodeCrewMember>?,
|
||||||
@SerializedName("guest_starts") val guestStars: List<CastMember>?
|
@SerializedName("guest_starts") val guestStars: List<EpisodeCastMember>?
|
||||||
)
|
)
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
package com.owenlejeune.tvtime.api.tmdb.api.v3.model
|
package com.owenlejeune.tvtime.api.tmdb.api.v3.model
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName
|
import com.google.gson.annotations.SerializedName
|
||||||
|
import com.owenlejeune.tvtime.utils.types.Gender
|
||||||
|
|
||||||
open class Person(
|
open class Person(
|
||||||
@SerializedName("id") val id: Int,
|
@SerializedName("id") val id: Int,
|
||||||
@SerializedName("name") val name: String,
|
@SerializedName("name") val name: String,
|
||||||
@SerializedName("gender") val gender: Int,
|
@SerializedName("gender") val gender: Gender,
|
||||||
@SerializedName("profile_path") val profilePath: String?
|
@SerializedName("profile_path") val profilePath: String?
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -629,8 +629,18 @@ private fun CastCrewCard(appNavController: NavController, person: Person) {
|
|||||||
.width(124.dp)
|
.width(124.dp)
|
||||||
.wrapContentHeight(),
|
.wrapContentHeight(),
|
||||||
subtitle = when (person) {
|
subtitle = when (person) {
|
||||||
is CastMember -> person.character
|
is MovieCastMember -> person.character
|
||||||
is CrewMember -> person.job
|
is MovieCrewMember -> person.job
|
||||||
|
is TvCastMember -> {
|
||||||
|
val roles = person.roles.joinToString(separator = "/") { it.role }
|
||||||
|
val epsCount = person.totalEpisodeCount
|
||||||
|
"$roles ($epsCount Eps.)"
|
||||||
|
}
|
||||||
|
is TvCrewMember -> {
|
||||||
|
val roles = person.jobs.joinToString(separator = "/") { it.role }
|
||||||
|
val epsCount = person.totalEpisodeCount
|
||||||
|
"$roles ($epsCount Eps.)"
|
||||||
|
}
|
||||||
else -> null
|
else -> null
|
||||||
},
|
},
|
||||||
imageUrl = TmdbUtils.getFullPersonImagePath(person),
|
imageUrl = TmdbUtils.getFullPersonImagePath(person),
|
||||||
|
|||||||
Reference in New Issue
Block a user