-
Notifications
You must be signed in to change notification settings - Fork 10
/
.tmdb-functions
34 lines (23 loc) · 1.18 KB
/
.tmdb-functions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
TMDB_BASE_URL="https://api.themoviedb.org/3"
TMDB_MOVIE_URL="$TMDB_BASE_URL/search/movie?api_key=33057cfd52b346e4cac13439c65ee6f4&page=1"
TMDB_SEARCH_SERIE_URL="$TMDB_BASE_URL/search/tv?api_key=33057cfd52b346e4cac13439c65ee6f4&page=1"
function getEpisodeName {
EPISODE_ID_CURL="$TMDB_SEARCH_SERIE_URL&query=${1// /%20}"
EPISODE_ID="$(curl -s $EPISODE_ID_CURL |jq -r ".results[0].id")"
TMDB_SEARCH_SERIE_EPISODE_URL="$TMDB_BASE_URL/tv/$EPISODE_ID/season/$2/episode/$3?api_key=33057cfd52b346e4cac13439c65ee6f4"
EPISODE_DESCRIPTION="$(curl -s $TMDB_SEARCH_SERIE_EPISODE_URL |jq -r .name)"
echo $EPISODE_DESCRIPTION
}
function getEpisodeDescription {
EPISODE_ID_CURL="$TMDB_SEARCH_SERIE_URL&query=${1// /%20}"
EPISODE_ID="$(curl -s $EPISODE_ID_CURL |jq -r ".results[0].id")"
TMDB_SEARCH_SERIE_EPISODE_URL="$TMDB_BASE_URL/tv/$EPISODE_ID/season/$2/episode/$3?api_key=33057cfd52b346e4cac13439c65ee6f4"
EPISODE_DESCRIPTION="$(curl -s $TMDB_SEARCH_SERIE_EPISODE_URL |jq -r .overview)"
echo $EPISODE_DESCRIPTION
}
function getMovieDescription {
CURL_URL="$TMDB_MOVIE_URL&query=${1// /%20}"
MOVIE_DESCRIPTION=$(curl -s $CURL_URL |jq -r ".results[0].overview")
echo $MOVIE_DESCRIPTION
}