golift / starr

Starr Library: Fully functional go package to interact with Lidarr, Prowlarr, Radarr, Readarr, and Sonarr APIs.
https://golift.io/discord
MIT License
69 stars 18 forks source link

Add movie editor endpoints #69

Closed davidnewhall closed 2 years ago

davidnewhall commented 2 years ago

Adds movie editor endpoint. Adds movie delete and bulk delete endpoints. Closes #68. @NCRoxas, can you test this?

edit := &radarr.BulkEdit{
    MovieIDs:    []int64{7, 3},
    Monitored:   starr.True(),
    DeleteFiles: starr.False(),
}
movies, err := r.EditMovies(edit)
d34dscene commented 2 years ago

Looks great! Unmonitoring works, but DeleteFiles and AddImportExclusion doesn't work on my end.

davidnewhall commented 2 years ago

Did you mean DeleteMovie or DeleteMovies?

We'll have to address AddImportExclusion in another conversation. edit: oh, derp, you mean AddImportExclusion as part of the input. I see it now. Can you share your code?

davidnewhall commented 2 years ago

AddImportExclusion is documented here: https://radarr.video/docs/api/#/MovieEditor/delete_api_v3_movie_editor ...but I don't see any way to trigger it in the UI, so it may not actual work? Can you get an example payload where this works?

d34dscene commented 2 years ago

I meant DeleteFiles in this code block

edit := &radarr.EditMovies{
  MovieIDs:    []int64{1, 2, 3},
  Monitored:   starr.True(),
  DeleteFiles: starr.True(),
}

So it bulk deletes all movies and their files.

For the AddImportExclusion I created a simple request:

request, _ := json.Marshal(map[string]any{
  "movieIds": []int64{1, 2, 3},
  "monitored": false,
  "deleteFiles": true,
  "addImportExclusion": true,
})

and sent it via:

req, err := http.NewRequest("DELETE", url, bytes.NewBuffer(request))
// error handling
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
_, err := client.Do(req);
// error handling

url is xxx/api/v3/movie/editor?apikey=xxx

davidnewhall commented 2 years ago

I suspect those things do not actually work in radarr. Do you know how to do these actions in the UI? So I can reproduce and see what the difference is.

d34dscene commented 2 years ago

You can bulk delete movies in the UI by going to "Movies" > clicking on the "Movie Editor" button > selecting multiple movies and clicking on Delete on the bottom right. image But I don't think you can add movies to the exclusion list via the UI. That's only possible with an api call. The request I sent in the previous message actually works and it deletes all the movie files in the movieID list and puts the movies under "Settings" > "Lists" > "List Exclusions" in the UI.

davidnewhall commented 2 years ago

oh, I see what the problem is.

davidnewhall commented 2 years ago

Okay, I gave delete the same inputs as edit, so you can pass in those fields. Good to know how it works, thanks! I also renamed the struct to BulkEdit. Try this:

r.DeleteMovies(&radarr.BulkEdit{
  MovieIDs:           []int64{1, 2, 3},
  DeleteFiles:        starr.True(),
  Monitored:          starr.False(),
  AddImportExclusion: starr.True(),
})
d34dscene commented 2 years ago

Awesome it works now :D

bakerboy448 commented 2 years ago

AddImportExclusion is documented here: https://radarr.video/docs/api/#/MovieEditor/delete_api_v3_movie_editor ...but I don't see any way to trigger it in the UI, so it may not actual work? Can you get an example payload where this works?

This is a modal prompt when you delete movies. Same prompt when deleting movie (not via editor)

delete files add To exclusion list

bakerboy448 commented 2 years ago

But I don't think you can add movies to the exclusion list via the UI. That's only possible with an api call.

discover tab has this option to select and exclude

Otherwise when deleting a movie or movies the exclusion list is a modal confirmation checkbox

davidnewhall commented 2 years ago

I think I'm gonna turn those inputs into enums. We can probably re-use them in a few places.

davidnewhall commented 2 years ago

How's that look @Fuochi ?

austinwbest commented 1 year ago

But I don't think you can add movies to the exclusion list via the UI. That's only possible with an api call. The request I sent in the previous message actually works and it deletes all the movie files in the movieID list and puts the movies under "Settings" > "Lists" > "List Exclusions" in the UI.

You can add movies to the exclusion list on the List Exclusions page @NCRoxas ... There is a + at the bottom of the list.