Add the calendar view (M10)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"git.stinnesbeck.com/nils/arr-tui/internal/arr"
|
||||
)
|
||||
@@ -210,14 +211,17 @@ func (c *Client) Queue(ctx context.Context) ([]arr.QueueItem, error) {
|
||||
|
||||
// Episode is an episode of a library series.
|
||||
type Episode struct {
|
||||
ID int `json:"id"`
|
||||
SeriesID int `json:"seriesId"`
|
||||
SeasonNumber int `json:"seasonNumber"`
|
||||
EpisodeNumber int `json:"episodeNumber"`
|
||||
Title string `json:"title"`
|
||||
AirDate string `json:"airDate"`
|
||||
HasFile bool `json:"hasFile"`
|
||||
Monitored bool `json:"monitored"`
|
||||
ID int `json:"id"`
|
||||
SeriesID int `json:"seriesId"`
|
||||
SeasonNumber int `json:"seasonNumber"`
|
||||
EpisodeNumber int `json:"episodeNumber"`
|
||||
Title string `json:"title"`
|
||||
AirDate string `json:"airDate"`
|
||||
AirDateUTC string `json:"airDateUtc"`
|
||||
Overview string `json:"overview,omitempty"`
|
||||
HasFile bool `json:"hasFile"`
|
||||
Monitored bool `json:"monitored"`
|
||||
Series *Series `json:"series,omitempty"` // only with includeSeries
|
||||
}
|
||||
|
||||
// Episodes lists all episodes of a library series.
|
||||
@@ -257,3 +261,17 @@ func (c *Client) DeleteSeries(ctx context.Context, id int, deleteFiles, addExclu
|
||||
}
|
||||
return c.Do(ctx, http.MethodDelete, "series/"+strconv.Itoa(id), q, nil, nil)
|
||||
}
|
||||
|
||||
// Calendar lists the episodes airing between start and end, both inclusive,
|
||||
// with their series. Unmonitored episodes are only included when asked for.
|
||||
func (c *Client) Calendar(ctx context.Context, start, end time.Time, unmonitored bool) ([]Episode, error) {
|
||||
q := url.Values{
|
||||
"start": {start.Format("2006-01-02")},
|
||||
"end": {end.Format("2006-01-02")},
|
||||
"unmonitored": {strconv.FormatBool(unmonitored)},
|
||||
"includeSeries": {"true"},
|
||||
}
|
||||
var episodes []Episode
|
||||
err := c.Do(ctx, http.MethodGet, "calendar", q, nil, &episodes)
|
||||
return episodes, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user