XBMC SABnzbd+ Python Script
-
- Newbie
- Posts: 1
- Joined: February 11th, 2010, 5:13 pm
Re: XBMC SABnzbd+ Python Script
I was about to post another request for Attributes to be displayed for the videos from newzbin, but I think that's been done already. Is there a way to customize what information is shown already? instead of the title and size.
Oh, and this has just made an amazing HTPC that much better! Where would one donate to this project?
Oh, and this has just made an amazing HTPC that much better! Where would one donate to this project?
Re: XBMC SABnzbd+ Python Script
I would really appreciate some help here, when selecting an item in a queue the options are move to top and delete, these do not work for me I get the error.
Failed to contact sabnzb
this used to work but doesnt any more. This frustrated me so much that I looked up the sabnzbd API and decided to learn a little python too.
After figuring out the basics of the script I couldnt see a solution so I got wireshark on the case and determined that this is the URL that the script outputs
http://localhost:8080/sabnzbd/queue/del ... 4c1d3c30b2
wireshark tells me that this returns a 401
so I paste the URL into firefox, AND IT WORKS!
This doesnt make any sense to me so I did a comparison of the two requests in wireshark
This is the one from the script
GET /sabnzbd/queue/delete?uid=SABnzbd_nzo_qyANLB&ma_username=xbmcuser&ma_password=xbmcpass&apikey=b8f4229513908cb4968f874c1d3c30b2 HTTP/1.0
Host: localhost:8080
User-agent: Python-urllib/1.16
and I get the HTTP 401 response
HTTP/1.1 401 Unauthorized
Date: Tue, 16 Feb 2010 21:09:22 GMT
Content-Length: 218
Content-Type: text/html;charset=utf-8
Www-Authenticate: Basic realm="SABnzbd"
Server: CherryPy/3.2.0
Access denied
Error 401 Unauthorized: You need to provide a valid username and password.
and then from firefox
GET /sabnzbd/queue/delete?uid=SABnzbd_nzo_qyANLB&ma_username=xbmcuser&ma_password=xbmcpass&apikey=b8f4229513908cb4968f874c1d3c30b2 HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.1.7) Gecko/20100106 Ubuntu/9.10 (karmic) Firefox/3.5.7
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: session_id=7c39fd4b610b1f9c2d0f4658596bcc106c6f5929
Authorization: Basic eGJtYzp4Ym1j
and I get a valid response, I wont paste the whole thing as its too long
The worst part is this USED to work and I cant for the life of me think of anything I could have done to prevent it working anymore.
i really am hoping I can get this resolved as I am picking up this python malarky (at least I thought I was) and I would be happy to implement any more features I can figure out how to do.
Failed to contact sabnzb
this used to work but doesnt any more. This frustrated me so much that I looked up the sabnzbd API and decided to learn a little python too.
After figuring out the basics of the script I couldnt see a solution so I got wireshark on the case and determined that this is the URL that the script outputs
http://localhost:8080/sabnzbd/queue/del ... 4c1d3c30b2
wireshark tells me that this returns a 401
so I paste the URL into firefox, AND IT WORKS!
This doesnt make any sense to me so I did a comparison of the two requests in wireshark
This is the one from the script
GET /sabnzbd/queue/delete?uid=SABnzbd_nzo_qyANLB&ma_username=xbmcuser&ma_password=xbmcpass&apikey=b8f4229513908cb4968f874c1d3c30b2 HTTP/1.0
Host: localhost:8080
User-agent: Python-urllib/1.16
and I get the HTTP 401 response
HTTP/1.1 401 Unauthorized
Date: Tue, 16 Feb 2010 21:09:22 GMT
Content-Length: 218
Content-Type: text/html;charset=utf-8
Www-Authenticate: Basic realm="SABnzbd"
Server: CherryPy/3.2.0
Access denied
Error 401 Unauthorized: You need to provide a valid username and password.
and then from firefox
GET /sabnzbd/queue/delete?uid=SABnzbd_nzo_qyANLB&ma_username=xbmcuser&ma_password=xbmcpass&apikey=b8f4229513908cb4968f874c1d3c30b2 HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.1.7) Gecko/20100106 Ubuntu/9.10 (karmic) Firefox/3.5.7
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: session_id=7c39fd4b610b1f9c2d0f4658596bcc106c6f5929
Authorization: Basic eGJtYzp4Ym1j
and I get a valid response, I wont paste the whole thing as its too long
The worst part is this USED to work and I cant for the life of me think of anything I could have done to prevent it working anymore.
i really am hoping I can get this resolved as I am picking up this python malarky (at least I thought I was) and I would be happy to implement any more features I can figure out how to do.
Re: XBMC SABnzbd+ Python Script
Have you changed your sabnzbd username and password in config>general? Make sure it matches the one in the xbmc plugin settings.
Re: XBMC SABnzbd+ Python Script
nope, but thats the point. The URL your script outputs does work if I paste it into firefox so the username and password is ok. Also I am able to load the queue just not delete or move to top.
However I have also noticed that sab does not log the error so I think something else must be rejecting my connection. Its not apache, I shut it down just to be sure.
I notice the 401 comes from "Server: CherryPy/3.2.0" what is that? I have very limited python skills. Is there some kind of python HTTP handler before it gets to sabnzb that could be rejecting the connection? If so any idea where if anywhere this would be logged?
damn this is annoying.
However I have also noticed that sab does not log the error so I think something else must be rejecting my connection. Its not apache, I shut it down just to be sure.
I notice the 401 comes from "Server: CherryPy/3.2.0" what is that? I have very limited python skills. Is there some kind of python HTTP handler before it gets to sabnzb that could be rejecting the connection? If so any idea where if anywhere this would be logged?
damn this is annoying.
Last edited by jamesdew on February 16th, 2010, 7:02 pm, edited 1 time in total.
Re: XBMC SABnzbd+ Python Script
I see, that part is not compatible with the authorisation changes in 0.5
It should be using the new api commands instead. You could fix it by changing the command to the proper api command http://wiki.sabnzbd.org/api or embeding the url and pass in the call instead of ma_username and ma_password it needs to be http://user:pass@localhost/sabnzbd/queue...
It should be using the new api commands instead. You could fix it by changing the command to the proper api command http://wiki.sabnzbd.org/api or embeding the url and pass in the call instead of ma_username and ma_password it needs to be http://user:pass@localhost/sabnzbd/queue...
Re: XBMC SABnzbd+ Python Script
Thanks a lot for your reply, I will try adding user:pass@, that just might work.
However I still don't understand why the same URL works in firefox but not from python.
However I still don't understand why the same URL works in firefox but not from python.
Re: XBMC SABnzbd+ Python Script
Because you have already logged into SABnzbd with your browser. Your browser is then authenticated so does not need to pass any authentication details along inside the URL.
Re: XBMC SABnzbd+ Python Script
of course why didn't I think of that!
Anyway I fixed it, I also added the ability to resume and pause individual downloads as well as a global download/resume.
I did take out a little error handling though
#if resp:
# reload the queue
#xbmc.executebuiltin('Container.Refresh')
#else:
# self.dialog('Failed to contact SABnzbd')
For some reason this still generated an error response so I commented it out. I was going to fix it but I figure if SAB isn't working they wouldn't have been able to load the queue in the first place. Besides the refresh queue has never worked since it takes a few seconds to delete the download.
I guess I could stick a wait in there or it might even be better to back out of the queue, which I may add as soon as I figure out how to do that.
You can package this into a new release if you like, if anyone wants to add this functionality to the script they have now just replace /nzb/sabnzbd_actions.py with the file I have attached.
In case you are not sure what this does, once in the sab queue select an item and hit return, this gives you a list of options. Select pause/resume from the queue.
Thanks for creating this script I hope my small contribution can help
Anyway I fixed it, I also added the ability to resume and pause individual downloads as well as a global download/resume.
I did take out a little error handling though
#if resp:
# reload the queue
#xbmc.executebuiltin('Container.Refresh')
#else:
# self.dialog('Failed to contact SABnzbd')
For some reason this still generated an error response so I commented it out. I was going to fix it but I figure if SAB isn't working they wouldn't have been able to load the queue in the first place. Besides the refresh queue has never worked since it takes a few seconds to delete the download.
I guess I could stick a wait in there or it might even be better to back out of the queue, which I may add as soon as I figure out how to do that.
You can package this into a new release if you like, if anyone wants to add this functionality to the script they have now just replace /nzb/sabnzbd_actions.py with the file I have attached.
In case you are not sure what this does, once in the sab queue select an item and hit return, this gives you a list of options. Select pause/resume from the queue.
Thanks for creating this script I hope my small contribution can help
Re: XBMC SABnzbd+ Python Script
I made some more changes, I didn't like the lack of user feedback.
It now confirms the action with a message, however it doesn't do this based on a confirmation from SAB, it just assumes the action worked.
I would like to have it actually verify the response but I only started learning python on Tuesday so thats a bit beyond me right now.
I would also note that in fact xbmc.executebuiltin('Container.Refresh') doesnt actually seem to refresh the window, anyone any idea why?
It now confirms the action with a message, however it doesn't do this based on a confirmation from SAB, it just assumes the action worked.
I would like to have it actually verify the response but I only started learning python on Tuesday so thats a bit beyond me right now.
I would also note that in fact xbmc.executebuiltin('Container.Refresh') doesnt actually seem to refresh the window, anyone any idea why?
Re: XBMC SABnzbd+ Python Script
Hi
Thanks for great plugin. I do however have a problem
I can fine fetch records from newzbin but can not queue them in sabnzbd.
It works fine with other sources than newzbin, which is kind of strange.
The log says ERROR: Unable to find host: video
Please help
Thanks for great plugin. I do however have a problem
I can fine fetch records from newzbin but can not queue them in sabnzbd.
It works fine with other sources than newzbin, which is kind of strange.
The log says ERROR: Unable to find host: video
Please help
Re: XBMC SABnzbd+ Python Script
If it works with other sources it means your plug in can communicate with sab fine. You either dont have your newzbin RSS URL right or your log in info is incorrect. Newzbin works fine here.atholm wrote: Hi
Thanks for great plugin. I do however have a problem
I can fine fetch records from newzbin but can not queue them in sabnzbd.
It works fine with other sources than newzbin, which is kind of strange.
The log says ERROR: Unable to find host: video
Please help
By the way, are there any plans to implement HISTORY section , now that .5 version is practically out :-) ?
Re: XBMC SABnzbd+ Python Script
Hmm I just have version 1.54 installed and I'm sure that my login to newzbin is correct.
Also when I search for a file on newzbin I'm not able to queue it.
Also when I search for a file on newzbin I'm not able to queue it.
Re: XBMC SABnzbd+ Python Script
I realised I should point out that this only works on sab 5.xjamesdew wrote: I made some more changes, I didn't like the lack of user feedback.
It now confirms the action with a message, however it doesn't do this based on a confirmation from SAB, it just assumes the action worked.
I would like to have it actually verify the response but I only started learning python on Tuesday so thats a bit beyond me right now.
I would also note that in fact xbmc.executebuiltin('Container.Refresh') doesnt actually seem to refresh the window, anyone any idea why?
Re: XBMC SABnzbd+ Python Script
Hi
Well looks worth trying to run this on my XBMC Live HTPC
Gonna give it a go.
Would be cool if anyone could hook me up with a newzbin account. I'm surely willing to share a few bucks for that
Thx
BB
Well looks worth trying to run this on my XBMC Live HTPC
Gonna give it a go.
Would be cool if anyone could hook me up with a newzbin account. I'm surely willing to share a few bucks for that
Thx
BB
Re: XBMC SABnzbd+ Python Script
Switch, would you mind adding a way to view my history of recent sabnzb downloads? Every time I turn on my TV, I have to quit Plex and use a mouse to see what shows have downloaded since last time. It would be great to see what new shows I have with just a few clicks of the remote control. Thanks for all your work.