Accessing proxy settings from scripts.
If I am horribly off track please feel free to flame me.
import urllib2
proxy_handler = urllib2.ProxyHandler({'http': 'http://' + "192.168.1.0:8080"})
opener = ClientCookie.build_opener(proxy_handler)
ClientCookie.install_opener(opener)
The script in question used ClientCookie to open files, but as of Python 2.4 (which is included in xbmc) that is no longer necessary. So instead try replacing ClientCookie with urllib or urllib2 (depending on what the script uses):
import urllib2
proxy_handler = urllib2.ProxyHandler({'http': 'http://' + "192.168.1.0:8080"})
opener = urllib.build_opener(proxy_handler)
urllib.install_opener(opener)
if you put this code after importion of modules in a script it could work. Getting parameters and doing all this automagically would of course be way better than having to edit all scripts with potential problems that may cause (some scripts build their own openers). Remember to edit IP if you're gonna try this...
url = 'http://www.rocketboom.com/vlog/index.xml'
filename = 'Z:\temp.xml'
try:
os.remove(filename)
except:
pass
progress = xbmcgui.DialogProgress()
progress.create('Status','Retrieving Data from InternetnPlease be patient.')
progress.update(0)
response = xbmc.executehttpapi('FileDownloadFromInternet(' + url + ';' + filename + ')')
progress.close()
This manages to use XBMC internal network access which respects the proxy settings. Kinda messy though.
#If you have any other info about this subject , Please add it free.# |