Trakt lists: keep the Radarr/Sonarr lookups of their titles on disk
Library membership is asked every time via movie?tmdbId= / series?tvdbId=; only the lookups of titles not in the library are stored (3 days). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -102,6 +102,19 @@ func (c *Client) Movies(ctx context.Context) ([]Movie, error) {
|
||||
return movies, err
|
||||
}
|
||||
|
||||
// MovieByTMDB returns the library movie with the TMDb id, ok=false if the
|
||||
// library has none. Unlike a lookup it does not ask the metadata provider.
|
||||
func (c *Client) MovieByTMDB(ctx context.Context, tmdbID int) (Movie, bool, error) {
|
||||
var movies []Movie
|
||||
err := c.Do(ctx, http.MethodGet, "movie", url.Values{"tmdbId": {strconv.Itoa(tmdbID)}}, nil, &movies)
|
||||
for _, m := range movies { // checked: a version that ignores the filter sends the whole library
|
||||
if m.TMDBID == tmdbID && m.InLibrary() {
|
||||
return m, true, err
|
||||
}
|
||||
}
|
||||
return Movie{}, false, err
|
||||
}
|
||||
|
||||
// AddOptions are the choices from the add form.
|
||||
type AddOptions struct {
|
||||
QualityProfileID int
|
||||
|
||||
Reference in New Issue
Block a user