Remove titles from the library with a confirmation (M10)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-20 22:36:19 +02:00
co-authored by Claude Sonnet 5.5
parent ebbb3cd178
commit 7582504268
11 changed files with 174 additions and 5 deletions
+11
View File
@@ -246,3 +246,14 @@ func (c *Client) EpisodeFiles(ctx context.Context, seriesID int) ([]arr.MediaFil
err := c.Do(ctx, http.MethodGet, "episodefile", url.Values{"seriesId": {strconv.Itoa(seriesID)}}, nil, &files)
return files, err
}
// DeleteSeries removes a series from the library. With deleteFiles all its
// episode files are deleted from disk too; addExclusion keeps it from coming
// back through import lists.
func (c *Client) DeleteSeries(ctx context.Context, id int, deleteFiles, addExclusion bool) error {
q := url.Values{
"deleteFiles": {strconv.FormatBool(deleteFiles)},
"addImportListExclusion": {strconv.FormatBool(addExclusion)},
}
return c.Do(ctx, http.MethodDelete, "series/"+strconv.Itoa(id), q, nil, nil)
}
+15
View File
@@ -164,3 +164,18 @@ func TestEpisodeFiles(t *testing.T) {
t.Errorf("attrs = %+v", a)
}
}
func TestDeleteSeries(t *testing.T) {
c := newTestClient(t, func(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodDelete || r.URL.Path != "/api/v3/series/3" {
t.Errorf("unexpected request %s %s", r.Method, r.URL)
}
q := r.URL.Query()
if q.Get("deleteFiles") != "false" || q.Get("addImportListExclusion") != "true" {
t.Errorf("query = %v", q)
}
})
if err := c.DeleteSeries(context.Background(), 3, false, true); err != nil {
t.Fatal(err)
}
}