Created
February 26, 2021 14:55
-
-
Save courville/548469b86ae9294f9e98cbb52273a1db to your computer and use it in GitHub Desktop.
list all tmdb genres traductions and output result as markdown table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# API= your tmdb API key | |
# all lang except en | |
LANG=$(curl -s https://api.themoviedb.org/3/configuration/languages\?api_key=${API} | jq | grep iso_639_1 | sed 's/^.*"iso_639_1": "\([a-z][a-z]\).*$/\1/g' | grep -v en | sort -u) | |
for lang in $LANG | |
do | |
curl -s https://api.themoviedb.org/3/genre/movie/list\?api_key=${API}\&language=${lang} | jq | grep \"name\": | grep -v null | sed 's/^.*"name": "\([^"]*\)"/\1/g' > result-$lang | |
done | |
# remove empty translations | |
find . -size 0 -print -delete | |
# en master of all | |
curl -s https://api.themoviedb.org/3/genre/movie/list\?api_key=${API}\&language=en | jq | sed 's/^.*"id": //g' | sed 's/^.*"name": "\([^"]*\)"/\1/g' | sed "/[]{}[]/d" | sed 'N;s/,\n/|/' > result | |
# assemble result | |
for f in $(ls result-*) | |
do | |
paste -d '|' result $f > result-tmp | |
mv result-tmp result | |
done | |
cat result | sed 's/|/ | /g' | sed 's/^ //g' | sed 's/ $//g' > table | |
LANG=$(ls result-* | sort | sed 's/result-//g') | |
LANG="en "${LANG} | |
NB=$(echo $LANG | wc -w) | |
LINE="| "$(echo $LANG | sed "s/ / | /g")" |" | |
SEP=$(printf "%${NB}s" | sed 's/ /| --- /g')" |" | |
echo $LINE > final | |
echo $SEP >> final | |
cat table >> final |
Note: there are more claimed translated genres than in reality (many translations are set to null).
Note that latest version of the script is available here with some corrections: https://github.com/nova-video-player/aos-MediaLib/tree/v6/script
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This script outputs a markdown table of translated genres in tmdb i.e.: