Debug a addon using JSON-RPC and browser
#1
I was a bit surprised that folks aren't more aware what you can do with a browser to debug while developing an addon.
Previously, I posted this about enabling/disabling an addon using a browser.
2166014 (post)

The most frequent thing I use the browser and JSON-RPC for is looking at the kodi log, particularly if it's on my fire stick because I don't have a tail utility there.
Once you locate the url for the kodi log on a device, bookmark it, throw it on the bookmark bar and you have a single click access to the log.
I can make fast edits to the addon .py files in the addons directory to print any info I need to see to debug an issue into the log file and the with a click, see it in the browser, even from a remote fire stick.

First go to Settings->Services in Kodi and enable the web interface.

For windows:

Go to Kodi file manager and Add special://home as a source.

open a browser and paste the following url:
Code:
http://localhost/jsonrpc?request={"jsonrpc": "2.0", "id":1, "method": "Files.PrepareDownload", "params": { "path": "special://home/kodi.log" }}
which returns:

Code:
{"id":1,"jsonrpc":"2.0","result":{"details":{"path":"vfs/special%3a%2f%2fhome%2fkodi.log"},"mode":"redirect","protocol":"http"}}

To display the log in a browser use the "path" returned above and prefix with your ip:port or hostname:

Code:
http://localhost/vfs/C%3a%2f%2fUsers%2fA%2fAppData%2fRoaming%2fKodi%2fkodi.log



For Amazon Fire Stick:
Go to Kodi file manager and Add special://home as a source.
Get the IP address of your Fire Stick (and the Kodi web server port, if not default 8080), in my case 10.0.0.4.
Note that the kodi.log file is at special://home/temp for most android devices.

Code:
http://10.0.0.4:8080/jsonrpc?request={"jsonrpc": "2.0", "id":1, "method": "Files.PrepareDownload", "params": { "path": "special://home/temp/kodi.log" }}

which returns:
Code:
{"id":1,"jsonrpc":"2.0","result":{"details":{"path":"vfs/special%3a%2f%2fhome%2ftemp%2fkodi.log"},"mode":"redirect","protocol":"http"}}

So to display the kodi log in the browser use:

Code:
http://10.0.0.4:8080/vfs/special%3a%2f%2fhome%2ftemp%2fkodi.log
Reply
#2
Thanks!
Reply

Logout Mark Read Team Forum Stats Members Help
Debug a addon using JSON-RPC and browser0