Kodi Community Forum
Usage of XBMC->WriteFile in PVR Addon - 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)
+---- Forum: PVR (https://forum.kodi.tv/forumdisplay.php?fid=136)
+---- Thread: Usage of XBMC->WriteFile in PVR Addon (/showthread.php?tid=145182)



Usage of XBMC->WriteFile in PVR Addon - zeroniak - 2012-11-14

Hi,

I'm developing a DVBLink Server PVR Addon for XBMC. The DVBLink API uses http post, which makes it a bit difficult to work with in relation to XBMC. I know I can't use Libcurl and was thus trying out the XBMC (CHelper_libXBMC_addon) methods OpenFileForWrite/WriteFile. They seemed to work in that they infact is using http post and request are getting to the server, but server don't return what was expected (xml data).

After some investigation I found out that when used on http they use the CHTTPFile::Write method. In this method I can see that the mime type is forced to be "application/json". Is this a bug or intentional ? I know it is likely because it in the past has only been used with json call, but would it be possible to make it a more general solution ?

Just to see what happend I tried to change it to general http post content type "application/x-www-form-urlencoded", and guess what it worked Smile But it just puts even more emphasis on my question Smile

/Zeroniak


RE: Usage of XBMC->WriteFile in PVR Addon - da-anda - 2012-11-14

it's not a bug nor intentional - well, a bit intentional. Thing is, after the removal of curl for PVR addons there was no way to do post calls, which where required by the 4TheRecord addon. RedF then took the time to find a quick and clean fix for it and created the post abstraction you currently see. Long term plans (AFAIK) are to make the mime time configurable, but there was no immediate solution for this and feature freeze for Frodo was to close to wait any longer. So fixing it was postponed for after Frodo. But if you have an idea on how to make the mime type configurable in a nice and clean way, go ahead and add a PR for it, and with luck our release manager might let it in for Frodo (no guarantee)


RE: Usage of XBMC->WriteFile in PVR Addon - zeroniak - 2012-12-08

I have made a temporary work around in my addon, as I did not feel enough into the inner workings xbmc and what other code relied on the method to know if I would break any thing..
And since it would likely not get into Frodo any way, I decided I would look at it later and instead focus on getting my addon working.


RE: Usage of XBMC->WriteFile in PVR Addon - opdenkamp - 2012-12-10

it'll need api changes to set the mime type, and it's too late for that now. something for frodo+1


RE: Usage of XBMC->WriteFile in PVR Addon - zeroniak - 2012-12-10

I came to the same conclusion, which was why I wrote a temporary workaround (using sockets) in my add-on Smile But will try to make a modification to XBMC when Frodo is released.