05-21-2018, 03:45 PM
(05-21-2018, 02:04 PM)TheOldPresbyope Wrote:(05-21-2018, 01:49 PM)Max Schmeling Wrote: After upgrading to Moode 4.1 I get an database error when I try to access the moode-sqlite3.db
To connect to the database with Python, I do this:
Which works fine.Code:try:
con = SQLite3.connect('/var/local/www/db/moode-sqlite3.db')
except SQLite3.Error, e:
if Debug: print "Error %s:" % e.args[0]
sys.exit(1)
To figure out if Airplay is active, I used to do this:
Code:# Airplay state check
def IsAirplayOn():
global ButtonOverride
AirplayOn = False
try:
cur = con.cursor()
cur.execute('select value from cfg_engine where param=\'airplayactv\'')
data = cur.fetchone()[0]
if (Debug): print "SQL = %s" % data
if data == "1":
AirplayOn = True
except SQLite3.Error, e:
if (Debug): print "Error %s:" % e.args[0]
if ButtonOverride:
AirplayOn = False
if Debug: print "Returning IsAirplayOn = {0}".format(AirplayOn)
return AirplayOn
But this gives me an error about the table cfg_engine, which seems to have been changed.
Does anybody know which table and parameter, I should be querying, or just how to find out if Airplay is active?
Hi, Max.
the sqlite3 command .tables will list the tables. You're now looking for cfg_system, in which param 50="airplayactv".
Regards,
Kent
I'll try that. Thanks
Max Schmeling