First thing first, this is a very basic addon, as well as my first addon ever for kodi.
I’ve simply cloned the hello world example and changed the addon.py file to this:
import xbmcaddon
import xbmcgui
import subprocess
import urllib
import requests
import json
addon = xbmcaddon.Addon()
addonname = addon.getAddonInfo(‘name’)
def check_location():
send_url = ‘http://freegeoip.net/json’
r = requests.get(send_url)
j = json.loads(r.text)
city = j[‘city’]
return “Currently connected from: ” + city;
def check_ip():
public_ip = subprocess.check_output([“ifconfig `ip route get 8.8.8.8 | grep 8.8.8.8 | cut -d’ ‘ -f5` | grep \’inet \’ | awk -F'[: ]+’ ‘{ print $4 }'”], shell=True);
result = (“Your IP is : %s ” % public_ip);
return result;
xbmcgui.Dialog().ok(“Check IP and Location”, check_ip(), check_location())
This simple script, get the external Ip and the location and prints them in a modal when runs.
What I’d like to do, is to have this results printed on the home page (I am using titan skin if this help in any way) but I have no idea where to start, as google doesn’t really help either.
I don’t care if I have to create two new menu entries with that as a result, or I have I to change some skin files, but the idea is to keep the IP and the Location always visible on the home page, as I need to check instantly if my VPN drops the connection so that I can reconnect (or at least I know i’m not connected anymore)
I’ve also posted this on stackoverflow, and the url is here: http://stackoverflow.com/questions/43707…-home-page but I think I might have more possibilities to get an useful response here.
Thanks in advance for any help