-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prowlarr /search Sonarr /release end points #162
Comments
Hello, I've added methods and structs for both of these api endpoints. Can you test the new code? Thanks! |
I could write a copy function that uses reflection to copy all values from one struct to another if the name and types match. So you'd do something like this:
As for points 1 and 2: The library is never finished. The starr apps are under constant development. I make releases along the way, but we're always adding new methods and structs, so yes, you'd have to use a hashref to keep the newest version. If we got all the feature you need in place, I'd be happy to cut a release you can lock yourself to. Your thoughts are welcomed. |
My initial thought is
I've seen there are other libraries that do this. I think it could work.
That's what I thought - hence why I see them as very minor challenges. I'll branch my PR branch and try to refactor again to use starr That way I can be much more specific on what is preventing adopting starr. Using resty has been simple to integrate. A bit perverse, have created a jupyter notebook that does a pretty decent job of generating go |
being able to unmarshal into a custom struct is not straight forward with starr, but it's not impossible. Here's an example saving prowler indexers into the sonarr type: func main() {
p := prowlarr.New(&starr.Config{})
var output sonarr.IndexerOutput
req := starr.Request{URI: path.Join(prowlarr.APIver + "/indexer", fmt.Sprint(indexerID))}
if err := s.GetInto(ctx, req, &output); err != nil {
return nil, fmt.Errorf("api.Get(%s): %w", &req, err)
}
} Writing this example makes me want to expose all the I don't personally care for this, and think a copy method would be easier to maintain. I'm almost done writing something you can test. |
I spent much longer than I wanted to trying to figure out how to copy into an initialized I'll add that this still isn't perfect, and I'm willing to make more api-method-specific copy methods if you think it'd be useful. What I mean by that is a method named Things this current implementation can't directly account for are "zeroing" the ID, possibly tags, and settings these:
EDIT: It can account for these now ^ example in the linked pull request description. |
Created the |
Thanks, I've forked PR #163. It appears you have missed the prowlarr /search POST endpoint. The equivalent of the I will want the radarr /release end point as well. Plus /indexer/bulk on sonarr and radarr To get me going with casting I've coded this:
As I'm refactoring this I'm getting optimistic I can do away with casting and use generics. |
The contents of #164 and #166 are merged in the dn2_both branch. Hoping it has everything you could need. Lemme know! |
I've just published this https://github.com/rraymondgh/starr/tree/dn2_both_local branch. Which has fixups to structures to resolve json marshalling errors
Thoughts - happy to generate a PR to be able to merge these changes back into your branch |
Thanks for the follow-up! I have some questions :)
|
It's this code that fails:
when converting from a radarr release
Whenever the json api states that it is nullable, you have omit empty. It's really to give JSON marshalling a better chance if the data types are slightly divergent between the arrs. python code...
You have to call the GET endpoint before using the POST end point. Let me see if I can standalone go code that demonstrates what I found.
|
This is only true for inputs. We are not using these structs as inputs afaik. As an example I put omitempty on the EDIT2: I'd also like to point out that season and episode numbers are always EDIT3: After confirming the type for |
I'm a bit more confused about |
I updated the dn2_grab branch.
|
I figured out the radarr problem. Will fix. https://github.com/Radarr/Radarr/blob/3c737c2c172fdc07e08c754fe03c8ab4afd0fde9/src/Radarr.Api.V3/Indexers/ReleaseController.cs#L77-L81 |
Have just pulled the updated branch - compiled and run my tests. Getting this error again:
|
I just fixed that and pushed an update. You can now use If you're not using |
I just ran 20 info hashes via bitmagnet graphql interface. 10 are not supposed to results in downloads as they do not exist in my sonarr or radarr instances. 10 should result in downloads (5 movies and 5 episodes). All went through |
Went through correctly, or you're saying 10 that should not download, did? |
Went through correctly - the way I've designed test suite. Some expected positive tests and some expected negative tests. Just reviewed prowlarr search, there is an option to remove Grab struct there too |
done. |
Let me know if we're good, or if you need anything else. After we're done here, I'll add release endpoints to lidarr and readarr for consistency. |
I still sort of think you should consider using the orbit library instead of maintaining those Recast functions yourself. Resetting tags and IDs seems prudent at least. |
Somewhat of a delay - I'm actually working on a new services docker container that will use this which can then optionally be used by bitmagnet. bitmagnet doesn't want to merge due to a reasonable concern that an indexer being called many times is logically wrong to invoke a download in a client. Hopefully I shouldn't be too long before I'm ready to ship a first alpha version of this container that can be used by bitmagnet |
I can't see either of these end points in the API.
The text was updated successfully, but these errors were encountered: