Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discover: filter by genres #1075

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import com.uwetrottmann.tmdb2.entities.BaseTvShow
import com.uwetrottmann.tmdb2.entities.Credits
import com.uwetrottmann.tmdb2.entities.DiscoverFilter
import com.uwetrottmann.tmdb2.entities.DiscoverFilter.Separator.OR
import com.uwetrottmann.tmdb2.entities.Genre
import com.uwetrottmann.tmdb2.entities.Person
import com.uwetrottmann.tmdb2.entities.TmdbDate
import com.uwetrottmann.tmdb2.entities.TvEpisode
Expand Down Expand Up @@ -228,6 +229,20 @@ class TmdbTools2 {
return null
}

suspend fun getShowGenres(tmdb: Tmdb, language: String): List<Genre>? {
try {
val response = tmdb.genreService().tv(language).awaitResponse()
if (response.isSuccessful) {
return response.body()?.genres
} else {
Errors.logAndReport("load show genres", response)
}
} catch (e: Exception) {
Errors.logAndReport("load show genres", e)
}
return null
}

fun getShowTrailerYoutubeId(
context: Context,
showTmdbId: Int,
Expand Down