Posts: 26,215
Joined: Oct 2003
Reputation:
187
Hi there,
Quite a few plugins seem to have problems due to a change in XBMC's URL handling. The gist of it is that all URL options need to be URL encoded.
This is so that we can parse them reliably (it's also so that the URLs are valid).
i.e.
plugin://plugin.foo.bar/what/ever/you/like?url_option=<url encoded option>&url_option2=<url encoded option>
Cheers,
Jonathan
Posts: 3
Joined: Dec 2012
Reputation:
0
so how do I enter this and where?
Posts: 28
Joined: Jan 2011
Reputation:
0
2012-12-18, 17:34
(This post was last modified: 2012-12-18, 17:35 by rimram31.)
Not so much used in python add on I've seen, but parse_qs (urlparse) and urlencode (urllib) standard python functions do the job for you ...
A parse_qs(urlparse(url).query) return a dictionnary of the parameters already decoded if needed (%...), sure url may contain sys.argv[2] for a plugin (be careful, the dictionnary returned by parse_qs contain arrays of values as a http parameter may be a list of values) and in the other side, a urlencode(<python dictionnary>) return an encoded query part in the form field1=xxxx&field2=yyy%3F ...
This will save time and make more readable code.
Posts: 28
Joined: Jan 2011
Reputation:
0
2012-12-20, 10:17
(This post was last modified: 2012-12-20, 10:18 by rimram31.)
Yes, and you get back your parameters with a simple parameters = parse_qs(urlparse(sys.argv[2]).query) -> parameters ["mode"][0], parameters ["link"][0] ... with your example.
With two line of code, you can write your add on having "simple" dictionnaries and forget unreadable url scheme.