Problem with image URLs containing GET parameters - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32) +--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26) +--- Thread: Problem with image URLs containing GET parameters (/showthread.php?tid=118829) |
Problem with image URLs containing GET parameters - gderosa - 2012-01-05 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 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/blob/7a315b7202f027ebf2eb0bd00c91d5974e3cc185/resources/lib/gui/popup/camera.py#L29 So I'm just calling this function: http://xbmc.sourceforge.net/python-docs/xbmcgui.html#ControlImage-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 - gderosa - 2012-01-05 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 ) - Gujs - 2012-02-23 Hi, I have the same problem with some channel logo pictures. Did you maybe found a solution for this? - VictorV - 2012-02-23 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. - jmarshall - 2012-02-24 @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 RE: Problem with image URLs containing GET parameters - BlueCop - 2012-05-10 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. RE: Problem with image URLs containing GET parameters - AddonScriptorDE - 2013-07-22 (2012-05-10, 20:16)BlueCop Wrote: I think I stumbled across this problem with Chunked Transfer-Encoding.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? RE: Problem with image URLs containing GET parameters - VictorV - 2013-11-13 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. RE: Problem with image URLs containing GET parameters - xnappo - 2013-11-13 (2013-11-13, 02:01)VictorV Wrote: Got a request for my solution to this, and wrote some example code. 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 RE: Problem with image URLs containing GET parameters - xnappo - 2014-01-11 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 |