30 lines
769 B
Python
30 lines
769 B
Python
import xbmcaddon
|
|
import xbmcgui
|
|
import mysql.connector
|
|
|
|
#ssid = "altnet-guest"
|
|
|
|
addon = xbmcaddon.Addon()
|
|
addonname = addon.getAddonInfo('name')
|
|
|
|
ssid = addon.getSetting('ssid')
|
|
bdd_host = addon.getSetting('host')
|
|
bdd_user = addon.getSetting('username')
|
|
bdd_pass = addon.getSetting('password')
|
|
bdd_base = addon.getSetting('database')
|
|
|
|
cnx = mysql.connector.connect(user=bdd_user, password=bdd_pass,
|
|
host=bdd_host, database=bdd_base)
|
|
|
|
cursor = cnx.cursor()
|
|
query = ("SELECT password FROM alt_guest_wifi "
|
|
"WHERE ssid LIKE \"%s\" LIMIT 1") % ssid
|
|
|
|
cursor.execute(query)
|
|
row = cursor.fetchone()
|
|
cursor.close()
|
|
cnx.close()
|
|
|
|
line = "This week's password for %s is:\n\n%s" % (ssid, row[0])
|
|
|
|
xbmcgui.Dialog().ok(addonname, line)
|