Item URL encoding - Strange problem...
#1
Hi,
I have a problem with one of my add-ons:
The add-on needs to access the currently selected Item URL and the currently played Item URL.
When receiving the URL of the played Item i get the correct encoded URL:

Code:
playlist[playlist.getposition()].getfilename()
plugin://plugin.video.test123/?url=http%3A%2F%2Fwww.test123.com%2Findex.php%3Fa%3Db%26c%3Dd%26e%3Df&mode=playVideo&a=b

But when accessing the URL of the selected Item i get a complete decoded URL:

Code:
xbmc.getInfoLabel('ListItem.FileNameAndPath')
plugin://plugin.video.test123/?url=http://www.test123.com/index.php?a=b&c=d&e=f&mode=playVideo&a=b

XBMC / the add-on cant handle the decoded URL because of the parameters.
Is this a bug? I dont know how to encode the URL correctly because only the red part must be encoded, the rest has to stay untouched.
The problem is, that I think its impossible to split the string with regex or by hand, because of the "?" and "=" in both the add-on URL and the HTTP URL.

Would be awesome if someone knows a solution.
Perhaps there is a way to get the correct encoded URL? Or anybody knows how to split this nerving string?

greetings
asde
Reply
#2
Correct - for some odd reason a URL Decode is being run. I'm not sure why to be honest. Will do a git blame and see what the issue is.

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#3
Looks like it's like this for display in the skin - note that user information (user/password) are stripped off as well. It's been like this for almost 4 years.

I'm not sure whether you can get the info any other way - eg it may be possible to get it via jsonrpc?
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#4
(2012-06-03, 04:18)jmarshall Wrote: Looks like it's like this for display in the skin - note that user information (user/password) are stripped off as well. It's been like this for almost 4 years.

I'm not sure whether you can get the info any other way - eg it may be possible to get it via jsonrpc?
Thanks for your help, will check out the jsonrpc. When I use json (and its even possible this way), does every user of the add-on has to enable webinterface access?

Would it be possible to implement a new InfoLabel like "ListItem.FileNameAndPathUrlEncoded" or another solution to fix this problem in frodo or next eden update (if an update is planned)?
Reply
#5
(2012-06-03, 04:53)AddonScriptorDE Wrote: When I use json (and its even possible this way), does every user of the add-on has to enable webinterface access?

If you use:
Code:
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "", "params": {}, "id": 1}')
it's an internal request, webinterface doesn't need to be turned on.
My GitHub. My Add-ons:
Image
Reply
#6
(2012-06-03, 12:54)sphere Wrote:
(2012-06-03, 04:53)AddonScriptorDE Wrote: When I use json (and its even possible this way), does every user of the add-on has to enable webinterface access?

If you use:
Code:
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "", "params": {}, "id": 1}')
it's an internal request, webinterface doesn't need to be turned on.
Thanks,
I will look if its possible to get the currently selected Item URL via json.
Reply
#7
I looked on http://wiki.xbmc.org/index.php?title=JSON-RPC_API/v4 but it seems there is no way to get the currently selected Item url via json Sad Or is there a way but i didnt find it?

It might be possible with something like that:
Code:
wnd = xbmcgui.Window(xbmcgui.getCurrentWindowId())
item = wnd.getControl(wnd.getFocusId()).getSelectedItem()
but this wont work. I cant get the selected Item. Selecting items is working with selectItem(pos), so I receive the correct ControlList. getSelectedPosition() returns -1.
How is this possible that getSelectedItem() and getSelectedPosition() are not working but selectItem(pos) does?

Perhaps someone could help me with this. A working code example for getSelectedItem() on the currently focused ControlList would be great Smile

Edit: Forget the problem with getSelectedItem() because i wanted to use getProperty(key) on the selected Item, but its also possible with "ListItem.Property()".
But it seems there is no property for the correct full path.
Reply
#8
(2012-06-03, 16:54)AddonScriptorDE Wrote: Perhaps someone could help me with this. A working code example for getSelectedItem() on the currently focused ControlList would be great Smile

That's what I do in the BigPictures Addon, see here for example usage of getSelectedItem()
My GitHub. My Add-ons:
Image
Reply
#9
(2012-06-05, 10:04)sphere Wrote:
(2012-06-03, 16:54)AddonScriptorDE Wrote: Perhaps someone could help me with this. A working code example for getSelectedItem() on the currently focused ControlList would be great Smile

That's what I do in the BigPictures Addon, see here for example usage of getSelectedItem()
Thx, but I cant get it working:
The weird problem is, that i get the correct ControlList with getControl(). selectItem(pos) is working on this Control, but somehow getSelectedItem() does not work.
Any idea? Anyone? Or another way for getting the Url of the selected item?

@jmarshall / Other TeamXBMC-Members: Would it be possible to implement a new InfoLabel like "ListItem.FileNameAndPathUrlEncoded" or another solution to fix this problem in frodo or next eden update (if an update is planned)?

Thanks,
asde
Reply
#10
Even if that was the case it doesn't necessarily solve the problem: The authentication details have also been removed prior to URL decoding.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#11
(2012-06-06, 01:37)jmarshall Wrote: Even if that was the case it doesn't necessarily solve the problem: The authentication details have also been removed prior to URL decoding.
Would it not be possible to add an InfoLabel with the encoded url and the authentication details, or is this not possible because of security reasons?
When receiving the currently played URL with:
Code:
playlist[playlist.getposition()].getfilename()
are the authentication details also removed?
Reply
#12
The problem is infolabels are designed for display in the skin - you're using them for quite a different purpose. I'm wary of exposing anything credentials-wise as it's too hard to restrict it.

The playlist stuff likely exposes directly as that's restricted to python.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#13
(2012-06-06, 01:59)jmarshall Wrote: The problem is infolabels are designed for display in the skin - you're using them for quite a different purpose. I'm wary of exposing anything credentials-wise as it's too hard to restrict it.

The playlist stuff likely exposes directly as that's restricted to python.
Ok, thanks. I hope there is another "raw python" way for getting the Url of the selected item.
Would be too bad if its technical impossible because except of this my add-on is working fine and i think it could be really useful.
Reply
#14
You could set your own property on each listitem formatted the way you want it.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#15
(2012-06-06, 06:40)Nuka1195 Wrote: You could set your own property on each listitem formatted the way you want it.
Thx, but I DONT want to access a single controllist, which i created by myself (with custom listitems).

I had to access the focused controllist (of the currently shown media) and the selected item in it.
The listitems i have to access are from the media library (video/audio/image) and from add-ons.

The problem is i need to get this value. I cant set anything i dont have.

Sorry, was not very clear. When you read the description of my add-on, i think you understand what i mean.
Reply



Logout Mark Read Team Forum Stats Members Help
Item URL encoding - Strange problem...0
This forum uses Lukasz Tkacz MyBB addons.