Add library view and series drill-down (M8)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-20 19:31:12 +02:00
co-authored by Claude Sonnet 5.5
parent a469eca871
commit 61373bbe45
11 changed files with 1080 additions and 18 deletions
+32 -2
View File
@@ -3,6 +3,7 @@ package radarr
import (
"context"
"encoding/json"
"net/http"
"net/url"
"strconv"
@@ -55,6 +56,28 @@ type Movie struct {
Monitored bool `json:"monitored"`
HasFile bool `json:"hasFile"`
QualityProfileID int `json:"qualityProfileId"`
SizeOnDisk int64 `json:"sizeOnDisk"`
IsAvailable bool `json:"isAvailable"`
Path string `json:"path,omitempty"`
MovieFile *MovieFile `json:"movieFile,omitempty"`
}
// MovieFile is the downloaded file of a library movie.
type MovieFile struct {
Size int64 `json:"size"`
Quality struct {
Quality struct {
Name string `json:"name"`
} `json:"quality"`
} `json:"quality"`
}
// QualityName returns the quality of the downloaded file, or "".
func (m Movie) QualityName() string {
if m.MovieFile == nil {
return ""
}
return m.MovieFile.Quality.Quality.Name
}
// InLibrary reports whether the movie has already been added to Radarr.
@@ -134,8 +157,7 @@ func (c *Client) AddMovie(ctx context.Context, m Movie, opts AddOptions) (Movie,
// SearchMovie triggers an automatic search for an existing library movie.
func (c *Client) SearchMovie(ctx context.Context, movieID int) error {
body := map[string]any{"name": "MoviesSearch", "movieIds": []int{movieID}}
return c.Do(ctx, http.MethodPost, "command", nil, body, nil)
return c.Command(ctx, map[string]any{"name": "MoviesSearch", "movieIds": []int{movieID}})
}
// TMDBTerm builds a lookup term for a TMDb id.
@@ -150,3 +172,11 @@ func (c *Client) Queue(ctx context.Context) ([]arr.QueueItem, error) {
func (c *Client) Releases(ctx context.Context, movieID int) ([]arr.Release, error) {
return c.Client.Releases(ctx, url.Values{"movieId": {strconv.Itoa(movieID)}})
}
// SetMonitored changes the monitored flag of a library movie.
func (c *Client) SetMonitored(ctx context.Context, movieID int, monitored bool) error {
return c.Update(ctx, "movie", movieID, func(o map[string]json.RawMessage) error {
arr.SetBool(o, "monitored", monitored)
return nil
})
}