Problem with image URLs containing GET parameters
#1
Hello, I'm developing an XBMC python addon which talks to a domotic (home automation) system:

http://dev.vemarsas.it/projects/xbmc-vera/wiki

Now I'm working on security cameras and I'm having a problem in displaying images whose URL contains '&', '?' or '=' .

So, look at this log:

Code:
10:04:19 T:139897994680064    INFO: easy_aquire - Created session to http://192.168.0.27
10:04:20 T:139897994680064   DEBUG: CFileCurl::GetMimeType - http://192.168.0.27:3480/data_request?id=cam_image&Device_Num=64 -> image/jpeg
10:04:23 T:139897994680064   DEBUG: GetImageHash - unable to stat url http://192.168.0.27:3480/data_request?id=cam_image&Device_Num=64

In the second line, you see that an HTTP GET (or at least HEAD) request has been properly performed (otherwise we couldn't know that MIME type is image/jpeg)

But in the third line there's an "unable to stat file" error :mad:

Everything works fine, instead, for URLs like http://www.example.com/myimage.jpg , and the image is properly displayed.

The "offending" code is here:

https://github.com/gderosa/xbmc-vera/blo...era.py#L29

So I'm just calling this function:

http://xbmc.sourceforge.net/python-docs/...e-setImage

I'm on Eden (latest git).

Strangely, there are no spaces or other characters which typically need to be url-escaped...

Thanks in advance!

Guido
Reply
#2
After deeper analysis, the problem does not lie in GET parameters but in the lack of Content-Length header in the HTTP server response.

So, my question is now how to workaround such situation (which is not necessarily a bug, btw, see http://en.wikipedia.org/wiki/Chunked_transfer_encoding )
Reply
#3
Hi,

I have the same problem with some channel logo pictures. Did you maybe found a solution for this?
Reply
#4
I ran into the very same problem a while ago. I ended up dowloading the images to local disk using a hash of the uri as filename, and finally passed that to the image control. It's a dirty workaround, but I didn't see any other solution from a addon developers view.
Reply
#5
@gderosa: The stat should return true even if the length is not specified in the header (assuming that it doesn't need to be). If so, this might be a bug. Please open a bug report on trac and cc elupus.

Thanks,
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
#6
I think I stumbled across this problem with Chunked Transfer-Encoding.

I have urls for png which I want to use for an icon and fanart.

I noticed that it wouldn't display the fanart and was getting this error.

Code:
GetImageHash - unable to stat url http://www.c-spanvideo.org/videoLibrary/showPicture.php?dispid=305749-1&width=640&height=360

I don't get the error if I use the same URL as an icon. It seems to cache and save the image fine. It only fails if assigned as fanart.

I checked the header for the transfer and it is "Transfer-Encoding: chunked". I will try to put something together to replicate it for a trac.

I found it odd that it would cache the image fine for an icon but would fail for fanart.
Reply
#7
(2012-05-10, 20:16)BlueCop Wrote: I think I stumbled across this problem with Chunked Transfer-Encoding.

I have urls for png which I want to use for an icon and fanart.

I noticed that it wouldn't display the fanart and was getting this error.

Code:
GetImageHash - unable to stat url http://www.c-spanvideo.org/videoLibrary/showPicture.php?dispid=305749-1&width=640&height=360

I don't get the error if I use the same URL as an icon. It seems to cache and save the image fine. It only fails if assigned as fanart.

I checked the header for the transfer and it is "Transfer-Encoding: chunked". I will try to put something together to replicate it for a trac.

I found it odd that it would cache the image fine for an icon but would fail for fanart.
Same here for images with chunked transfer-encoding. But i also get the error when using the image as an icon.
Any news on this?
Reply
#8
Got a request for my solution to this, and wrote some example code.

http://pastebin.com/BuqqMtdE

it's messy, it's heavy, it's not failsafe and maybe overkill for a simple problem, but as far as I can see, the only python solution.
This is sample code, and a real implementation would require some optimalization to the code and preferably threading.
Reply
#9
(2013-11-13, 02:01)VictorV Wrote: Got a request for my solution to this, and wrote some example code.

http://pastebin.com/BuqqMtdE

it's messy, it's heavy, it's not failsafe and maybe overkill for a simple problem, but as far as I can see, the only python solution.
This is sample code, and a real implementation would require some optimalization to the code and preferably threading.

Thanks. I ended up just always storing locally first because the server I am talking to uses chunked encoding 100% of the time. Your code is better for general purpose.

xnappo
Reply
#10
A fellow XBMB3C dev - null_pointer - came up with a different (better) solution - an image proxy service.

You get see the service in service.py here:
https://github.com/MediaBrowser/MediaBrowser.XBMC

xnappo
Reply

Logout Mark Read Team Forum Stats Members Help
Problem with image URLs containing GET parameters0