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 = "http://192.168.0.3:8080/sabnzbd/api?"
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)
Next
al.Sort
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)
Next
WScript.Echo "Done"
Function GetWebResponse(queryString)
Set wreq = CreateObject("MSXML2.XMLHTTP.3.0")
With wreq
.open "GET", url & queryString & apiKey, False
.send()
GetWebResponse = .responseText
End With
End Function