2012-07-06, 01:46
(2012-07-05, 22:25)bwqbbq Wrote: Awesome plug-in! I've added support to CouchPotato and sent a pull request for it. You should probably work on the documentation though, not all of the API calls are described on Github :p
I was also wondering if you could add support for nzbget? Aside from SABnzbd, it's the other major usenet client and I actually prefer it because it is so lightweight and uses a lot less resources. I've had a look at your plug-in and I've cooked up a quick code sample for the things you need. Would be great if you could add support for it!
Code:from xmlrpclib import ServerProxy
rpc = ServerProxy('http://nzbget:tegbzn6789@localhost:6789/xmlrpc')
# add nzb
#
rpc.append(nzb_name, 'movies', False, standard_b64encode(filedata.strip()))
# wait for the nzb to get added to nzbget
#
groups = rpc.listgroups()
while len(groups) == 0:
groups = rpc.listgroups()
last_group = len(groups) - 1
while os.path.basename(groups[last_group]['NZBFilename']) != nzb_name:
last_group = last_group - 1
if last_group <= 0:
last_group = len(groups) - 1
groups = rpc.listgroups()
first_id = groups[last_group]['FirstID']
last_id = groups[last_group]['LastID']
# add to top of queue
rpc.editqueue("GroupMoveTop", 0, "", last_id)
files = rpc.listfiles(first_id, last_id)
# you can loop through these and check the filename with files[index]['Filename']
Cool! Excellent work. Will take a look at nzbget once I get home from vacation...