Queue Sort Script

Come up with a useful post-processing script? Share it here!
Post Reply
Posts: 3
Joined: June 8th, 2012, 1:00 am

Queue Sort Script

Post by tolsen64 »

Just thought i'd share this script I came up with to sort my queue in size order so I get the smallest files first. I hope someone finds it useful.

Code: Select all

' SABNZBD Queue Sort by download size.
' Written by Terry R. Olsen on 6/6/2013
' http://boycot.no-ip.com

Const url = ""
Const apiKey = "&apikey=12def98767e7eac7e7a20154233fc0af"

Const qstatus = "mode=qstatus&output=xml"
Const switch = "mode=switch"

Set xmlDoc = CreateObject("MSXML2.DOMDOCUMENT.6.0")
xmlDoc.setProperty "SelectionLanguage", "XPath"
xmlDoc.loadXML GetWebResponse(qstatus)

Set al = CreateObject("System.Collections.ArrayList")

For Each n In xmldoc.selectNodes("/queue/jobs/job/mbleft")
	al.Add CDbl(n.text)


For i = 0 To al.Count - 1
	 nzbID = xmldoc.selectSingleNode("//jobs/job[mbleft='" & al(i) & "']/id").text
	 WScript.Echo nzbID
	 Call GetWebResponse(switch & "&value=" & nzbID & "&value2=" & i)

WScript.Echo "Done"

Function GetWebResponse(queryString)
	Set wreq = CreateObject("MSXML2.XMLHTTP.3.0")
	With wreq
		.open "GET", url & queryString & apiKey, False
		GetWebResponse = .responseText
	End With
End Function

Posts: 19
Joined: December 1st, 2019, 2:53 pm

Re: Queue Sort Script

Post by iUseNetter »

For others finding this thanks to Google:

In newer versions of SABnzbd you will find the option "Automatically sort queue" in SABnzbd Config -> Switches -> Queue.
For the above case you can choose "Sort by Size Smallest→Largest" from the drop down box.

Detailed information are available here: https://sabnzbd.org/wiki/configuration/ ... tches#toc2

Post Reply