Webserver on Android
#1
I am trying to develop an addon that will run in both a server mode and a client mode, the idea being that the server will have video files on it which it will make available to the clients via the Kodi websever interface.

It was all looking good until I tried to run the server addon on an Android tablet (Hudl2), this seems to refuse to make the files available via the Kodi webserver, I am using the following to create the url:

Code:
path = 'special://home/addons/script.video.myaddon/resources/video/video_1.m4v'
path = urllib.quote_plus(path)
url  = 'http://192.168.1.72:8080/vfs/%s'  % path

where 192.168.1.72 is the IP address of the Hudl2 device.

I have made special://home/addons/script.video.myaddon/resources/video/ a source of video on the device.

I have even also tried the code on the device itself, using both the IP address and localhost, neither work, both give a HTTP 401 error followed by

virtual bool XFILE::CFileCache::Open(const CURL&) - failed to open source <http://192.168.1.72:8080/vfs/special%3A%2F%2Fhome%2Faddons%2Fscript.video.myaddon%2Fresources%2Fvideo%2Fvideo_1.m4v>

A 401 appears to indicate that authentication is required, however, the Kodi webserver on the Hudl2 has both the user name and password blank so it shouldn't be needed (if I did have it how would I encode that in the URL?), I can also access the websever through a browser, by browsing to http://192.168.1.72:8080 which suggests it is okay.

I have tried the same code on Windows and that is fine, even the Android device itself can access videos on a Windows machine, the problem I'm having is basically being able to access the file on the Android via the Kodi webserver?

Could this be a bug in the Android webserver implementation or am I missing something??

I have tried all the obvious and am now at a loss as to what to try next Sad

Edit
I worked out how to add the authentication credentials

Code:
url  = 'http://USERNAME:[email protected]:8080/vfs/%s'  % path

Didn't help though Sad still giving a 401 error
Reply
#2
Right, I have made some progress.

It turns out that on the Android system I am using special://home resolves to

Code:
/storage/emulated/0/Android/data/org.xbmc.kodi/files

However, it seems that the call to the weberver requires the "real" path, which in my case is:

Code:
sdcard/Android/data/org.xbmc.kodi/files

At the moment I have hard-coded this and it all works perfectly, but if anyone can suggest a way of determining the path programmatically that would be great.

I the meantime I'm off to raise this as a bug on Trac.
Reply

Logout Mark Read Team Forum Stats Members Help
Webserver on Android0