Remove titles from the library with a confirmation (M10)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -170,3 +170,14 @@ func (c *Client) SetMonitored(ctx context.Context, movieID int, monitored bool)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
// DeleteMovie removes a movie from the library. With deleteFiles the movie's
|
||||
// files are deleted from disk too; addExclusion keeps it from coming back
|
||||
// through import lists.
|
||||
func (c *Client) DeleteMovie(ctx context.Context, id int, deleteFiles, addExclusion bool) error {
|
||||
q := url.Values{
|
||||
"deleteFiles": {strconv.FormatBool(deleteFiles)},
|
||||
"addImportExclusion": {strconv.FormatBool(addExclusion)},
|
||||
}
|
||||
return c.Do(ctx, http.MethodDelete, "movie/"+strconv.Itoa(id), q, nil, nil)
|
||||
}
|
||||
|
||||
@@ -161,3 +161,18 @@ func TestReleases(t *testing.T) {
|
||||
t.Fatalf("releases = %+v, %v", rels, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDeleteMovie(t *testing.T) {
|
||||
c := newTestClient(t, func(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method != http.MethodDelete || r.URL.Path != "/api/v3/movie/12" {
|
||||
t.Errorf("unexpected request %s %s", r.Method, r.URL)
|
||||
}
|
||||
q := r.URL.Query()
|
||||
if q.Get("deleteFiles") != "true" || q.Get("addImportExclusion") != "false" {
|
||||
t.Errorf("query = %v", q)
|
||||
}
|
||||
})
|
||||
if err := c.DeleteMovie(context.Background(), 12, true, false); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user