Skip to content

Instantly share code, notes, and snippets.

@mbobiosio
Created November 12, 2021 12:03
Show Gist options
  • Save mbobiosio/7aa2d83d9d00862cb2bb367a9233203a to your computer and use it in GitHub Desktop.
Save mbobiosio/7aa2d83d9d00862cb2bb367a9233203a to your computer and use it in GitHub Desktop.
/*
* Dealing with TMDB genres?
* This will help you fix that
*/
fun getGenre(ids:List<Int>):String{
var genre=""
for(i in ids ){
when (i) {
28 -> genre+="Action|"
12 -> genre+="Adventure|"
16 -> genre+="Animation|"
35 -> genre+="Comedy|"
80 -> genre+="Crime|"
99 -> genre+="Documentary|"
18 -> genre+="Drama|"
10751 -> genre+="Family|"
14 -> genre+="Fantasy|"
36 -> genre+="History|"
27 -> genre+="Horror|"
10402 -> genre+="Music|"
9648 -> genre+="Mystery|"
10749 -> genre+="Romance|"
878 -> genre+="Science Fiction|"
10770 -> genre+="TV Movie|"
53 -> genre+="Thriller|"
10752 -> genre+="War|"
37 -> genre+="Western|"
else -> genre+="Unresolved symbol:"+i
}
}
if(!genre.equals(""))
genre=genre.substring(0,genre.length-1)
return genre
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment