[Queue/Scheduler-Script] CappedDownloadQueue - Managed queue based on total size of downloading NZBs

Share your scripts or request scripts with specific features.
Forum rules
Please keep the forum clean - one topic per script. Questions not related to a specific script should be posted in Support forum.
Post Reply
Hidendra
Posts: 3
Joined: 13 Apr 2021, 19:01

[Queue/Scheduler-Script] CappedDownloadQueue - Managed queue based on total size of downloading NZBs

Post by Hidendra » 25 May 2021, 02:55

This script will manage queued NZBs such that the in-progress NZBs will in aggregate use less storage than the configured storage size - making it nigh impossible for NZBGet to hit "low space" conditions and pause the queue if the full configured storage size is guaranteed to be free to NZBGet.

So, if the configured storage size is 100 GB and you have 500 GB of NZBs queued, this script will ensure that only up to 100 GB of NZBs are running at any given time in any state (downloading, PP, script, etc). The remaining 400 GB will be paused. As NZBs fully complete paused downloads will be resumed in priority order as long as they do not cause the storage size to be exceeded.

TL;DR:
  • Queue-Script: Pauses all newly-added NZBs.
  • Scheduler-Script: Resumes NZBs (in priority order) until the sum of the size of resumed NZBs reaches the configured storage size limit.

The Scheduler component has a default task time (*) which runs at startup. It will continue to run forever using the configured SchedulerRefreshInterval (default 15 seconds) to guide how often the queue is checked for NZBs to resume.

This can be combined with StickyDownloadQueue to keep the download order within the set of NZBs that are unpaused consistent but is not strictly necessary - this script more or less solves the same issue but also solves others by simply managing the entire queue.

Note that any NZBs larger than the configured StorageSize will never be downloaded and will remain paused forever. This can be good or bad if your storage wouldn't have been large enough anyway but currently it will not be deleted by this script.


Requirements
  • NZBGet 18.0+
  • Python 2 or 3 accessible from NZBGet
  • No other scripts that intentionally pause / unpause NZBs. This script pauses ALL newly-added NZBs. It will resume any of them that it decides can be downloaded next.

Installation
Enable script under Extension Scripts > Extensions and reload.

The Scheduler portion of the script is automatically enabled to run on startup. No Task needs to be created under the Scheduler web page. To verify that it started and is running, you may check for this message on startup:

Code: Select all

CappedDownloadQueue: Starting scheduler script - will continue to run
License
MIT

Download / Source
GitHub: https://github.com/Hidendra/nzbget-capp ... e/releases

hugbug
Developer & Admin
Posts: 7623
Joined: 09 Sep 2008, 11:58
Location: Germany

Re: [Queue/Scheduler-Script] CappedDownloadQueue - Managed queue based on total size of downloading NZBs

Post by hugbug » 25 May 2021, 16:51

Great! Thanks for sharing this and the other script.

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests