From cc88099697489766eee6d7ea04750dbfa644aaeb Mon Sep 17 00:00:00 2001 From: Jon Maddox Date: Tue, 19 Dec 2023 08:50:09 -0500 Subject: [PATCH 1/2] load in Logos for TVImages --- tv.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tv.go b/tv.go index 5a6b814..3b87fcf 100644 --- a/tv.go +++ b/tv.go @@ -251,7 +251,6 @@ type TVAccountStates struct { // If it belongs to your favourite list. // // https://developers.themoviedb.org/3/tv/get-tv-account-states -// func (c *Client) GetTVAccountStates( id int, urlOptions map[string]string, @@ -580,6 +579,15 @@ type TVImages struct { VoteCount int64 `json:"vote_count"` Width int `json:"width"` } `json:"backdrops"` + Logos []struct { + AspectRatio float32 `json:"aspect_ratio"` + FilePath string `json:"file_path"` + Height int `json:"height"` + Iso639_1 string `json:"iso_639_1"` + VoteAverage float32 `json:"vote_average"` + VoteCount int64 `json:"vote_count"` + Width int `json:"width"` + } `json:"logos"` Posters []struct { AspectRatio float32 `json:"aspect_ratio"` FilePath string `json:"file_path"` From 1212a4bdee83abf8c200934d9216e774f3905fc5 Mon Sep 17 00:00:00 2001 From: Jon Maddox Date: Tue, 19 Dec 2023 09:16:38 -0500 Subject: [PATCH 2/2] Extract TVImage struct --- tv.go | 43 +++++++++++++++---------------------------- 1 file changed, 15 insertions(+), 28 deletions(-) diff --git a/tv.go b/tv.go index 3b87fcf..1b9a57f 100644 --- a/tv.go +++ b/tv.go @@ -567,36 +567,23 @@ func (c *Client) GetTVExternalIDs( return &tvExternalIDs, nil } +// TVImage type is a struct for a single image. +type TVImage struct { + AspectRatio float32 `json:"aspect_ratio"` + FilePath string `json:"file_path"` + Height int `json:"height"` + Iso639_1 string `json:"iso_639_1"` + VoteAverage float32 `json:"vote_average"` + VoteCount int64 `json:"vote_count"` + Width int `json:"width"` +} + // TVImages type is a struct for images JSON response. type TVImages struct { - ID int64 `json:"id,omitempty"` - Backdrops []struct { - AspectRatio float32 `json:"aspect_ratio"` - FilePath string `json:"file_path"` - Height int `json:"height"` - Iso639_1 string `json:"iso_639_1"` - VoteAverage float32 `json:"vote_average"` - VoteCount int64 `json:"vote_count"` - Width int `json:"width"` - } `json:"backdrops"` - Logos []struct { - AspectRatio float32 `json:"aspect_ratio"` - FilePath string `json:"file_path"` - Height int `json:"height"` - Iso639_1 string `json:"iso_639_1"` - VoteAverage float32 `json:"vote_average"` - VoteCount int64 `json:"vote_count"` - Width int `json:"width"` - } `json:"logos"` - Posters []struct { - AspectRatio float32 `json:"aspect_ratio"` - FilePath string `json:"file_path"` - Height int `json:"height"` - Iso639_1 string `json:"iso_639_1"` - VoteAverage float32 `json:"vote_average"` - VoteCount int64 `json:"vote_count"` - Width int `json:"width"` - } `json:"posters"` + ID int64 `json:"id,omitempty"` + Backdrops []MovieImage `json:"backdrops"` + Logos []MovieImage `json:"logos"` + Posters []MovieImage `json:"posters"` } // GetTVImages get the images that belong to a TV show.