Changelog 0.3.0

This commit is contained in:
Mukhtar Akere
2024-11-30 15:46:58 +01:00
parent df2aa4e361
commit a51364d150
53 changed files with 2019 additions and 679 deletions

31
pkg/arr/tmdb.go Normal file
View File

@@ -0,0 +1,31 @@
package arr
import (
"encoding/json"
"net/http"
url2 "net/url"
)
type TMDBResponse struct {
Page int `json:"page"`
Results []struct {
ID int `json:"id"`
Name string `json:"name"`
MediaType string `json:"media_type"`
PosterPath string `json:"poster_path"`
} `json:"results"`
}
func SearchTMDB(term string) (*TMDBResponse, error) {
resp, err := http.Get("https://api.themoviedb.org/3/search/multi?api_key=key&query=" + url2.QueryEscape(term))
if err != nil {
return nil, err
}
var data *TMDBResponse
if err = json.NewDecoder(resp.Body).Decode(&data); err != nil {
return nil, err
}
return data, nil
}