Fallenbagel / jellyseerr

Fork of overseerr for jellyfin support.
https://docs.jellyseerr.dev/
MIT License
3.49k stars 218 forks source link

[Feature Request] Refresh button for download sync #866

Open Fallenbagel opened 2 months ago

Fallenbagel commented 2 months ago

Description

Currently, we sync with sonarr/radarr with whatever value those return. And sonard/radarr Syncs the activity every 2 minutes afaik. However, there's a refresh button that can update the time.

Desired Behaviour

Add a refresh button on jellyseerr itself that calls the endpoint for refresh activity on radarr/sonarr, which should update on the *arr, thus returning a somewhat more accurate timings.

Additional Context

This FR is related to #865 and could solve the problem mentioned by them. The reason why this was created as a separate feature request was because the original FR was for synchronising with the client, which we don't plan to do. But this would be a better workaround for it.

Code of Conduct

gauthier-th commented 2 months ago

I was more thinking that we could call the refresh download endpoints from Radarr/Sonarr just before getting the values from Radarr/Sonarrr, so the timings are always more accurate. This could be enabled as an option since it will make addition requests to Radarr/Sonarr.

The Radarr/Sonarr request to update download times is POST /api/v3/command with this payload: { "name": "RefreshMonitoredDownloads" }

Nabstar3 commented 2 months ago

Pardon if this question sound dumb, but what does the 'Download Sync' job perform and would this may be a good function to add on this current feature to?

Fallenbagel commented 2 months ago

Pardon if this question sound dumb, but what does the 'Download Sync' job perform and would this may be a good function to add on this current feature to?

That's precisely the job that syncs with the sonarr/radarr. Which runs every 2 minutes. The reason why the estimated time is not accurate most of the time is because it's not accurate on sonarr/radarr (which also Syncs with the clients every 2 minutes). What this feature hopes to resolve is put a manual sync button.

Nabstar3 commented 1 month ago

What this feature hopes to resolve is put a manual sync button.

I understand.

Would it make more sense to create a new button or incorporate it into the functionality of Download Sync?

The workflow would be: Call the refresh download endpoints from Radarr/Sonarr -> Sync the the downloads on Jellyseerr.

This aligns with your above plan :

I was more thinking that we could call the refresh download endpoints from Radarr/Sonarr just before getting the values from Radarr/Sonarrr, so the timings are always more accurate

Nabstar3 commented 1 month ago

The Radarr/Sonarr request to update download times is POST /api/v3/command with this payload: { "name": "RefreshMonitoredDownloads" }

I went through it myself. I don't really know C# all too well, but I can sort of understand the process flow of how it works on Radarr's side:

CommandController received the RefreshMonitoredDownloads command and is picked up by the DownloadProcessingService which executes the ProcessMonitoredDownloadsCommand, which is tasked in scanning the current state of all monitored downloads. I believe this is done for all downloads so we would have to get radarr/sonarr to refresh the status for all downloads, not only an individual series/movie ID.

Here is an example POST call I got when I analysed the network traffic when clicking refresh under Queue:

http://radarr/api/v3/command

{
  "name": "RefreshMonitoredDownloads",
  "commandName": "Refresh Monitored Downloads",
  "body": {
    "sendUpdatesToClient": true,
    "updateScheduledTask": true,
    "requiresDiskAccess": false,
    "isExclusive": false,
    "isTypeExclusive": false,
    "isLongRunning": false,
    "name": "RefreshMonitoredDownloads",
    "trigger": "manual",
    "suppressMessages": true
  },
  "priority": "normal",
  "status": "queued",
  "result": "unknown",
  "queued": "2024-07-22T02:50:27Z",
  "trigger": "manual",
  "sendUpdatesToClient": true,
  "updateScheduledTask": true,
  "id": 49426
}

I haven't figured out exactly how we import and call API endpoints for Radarr/Sonarr but I did find where I should be looking for Download Sync in downloadtracker.ts

Fortunately, my ability to understand Typescript is better than C#, and I'll need to look a bit further on where we would be making our API call.