Skip to content
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

API assistance #1383

Closed
tidusjar opened this issue Jul 15, 2016 · 6 comments
Closed

API assistance #1383

tidusjar opened this issue Jul 15, 2016 · 6 comments

Comments

@tidusjar
Copy link

tidusjar commented Jul 15, 2016

Hello,

I've been developing PlexRequests.Net and the application integrates with Sonarr!

So I'm planning to develop a feature to be able to add specific episodes to Sonarr (We currently support specific series but there is a requirement to go to selecting individual episodes).

What in your opinion would be the best way to accomplish this with Sonarr.

My thought was to add the series into Sonarr as un-monitored and then POST the /episode endpoint and modify the monitored flag for each episode the user has selected.

Let me know your thoughts or if you think there is a better way to accomplish this.

(Referenced PR.Net issue: Ombi-app/Ombi#254)

@Taloth
Copy link
Member

Taloth commented Jul 17, 2016

You have to keep in mind that adding a new series doesn't immediately populate it's metadata. For that you'll have to check the /api/command endpoint (Under the hood Sonarr triggers an async RefreshSeries command). Or poll /api/series/{id}.

A POST on /api/episode is the only way to monitor it, but keep in mind that the series & season need to be monitored as well.
There are some edge cases, imagine a user with a series, which has several episodes monitored, but the series globally unmonitored. Now plexrequests comes along and tries to add an episode. Would it also monitor the series globally? How would it deal with the existing monitored episodes flags (which were effectively disabled due to the series being monitored globally)?

@tidusjar
Copy link
Author

So for Sonarr to search for an episode, the Series and Episode need to be monitored?

So we would also need to check the Series monitored status and set it to monitored... Which could potentially trigger multiple searches.

If there are multiple episodes that have the monitored flag, and the series is unmonitored, if I switch the series to monitored, would Sonarr search for all of the monitored episodes (if no file exists on disk)?

@markus101
Copy link
Member

So for Sonarr to search for an episode, the Series and Episode need to be monitored?

For Sonarr to automatically grab it from RSS it does, for a search of a single episode the monitored statuses of the series and episode are ignored (we assume you know what you're doing).

If there are multiple episodes that have the monitored flag, and the series is unmonitored, if I switch the series to monitored, would Sonarr search for all of the monitored episodes (if no file exists on disk)?

No, searches are entirely up to the user to trigger, though they would be susceptible to grabbing via RSS (The first two questions and answers in the FAQ explain in more detail how Sonarr finds things automatically).

@tidusjar
Copy link
Author

Thanks @markus101 That does clear things up.

So please correct me if this flow is wrong (I want to make sure I am using Sonarr the correct way)
image

So the above flow is for "requesting" a single episode, if the series doesn't exist then it will create it with an monitored status (Since we want a single episode).

@markus101
Copy link
Member

Between adding the series and monitoring the episode you'd need to wait for the episode metadata to download (which comes in via an SeriesRefresh), normally that data is fetched pretty quickly, the best way as @Taloth mentioned is to check the command endpoint to make sure that series isn't refreshing.

I'm assuming the EpisodeExist check is to see if there is an episode file, whether there is a file or not will be known when the series refresh finishes.

Besides the when to wait for metadata check that looks like it covers what you're looking to do.

@tidusjar
Copy link
Author

Thanks!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants