Thank you for your donation!

Python code for detecting if Airplay is active
I have previously used the following python code for detecting if Airplay is active:

# Connect to player database, in order to read Airplay status     
        con = SQLite3.connect('/var/local/www/db/moode-sqlite3.db')    
except SQLite3.Error as e:
        if Debug: print("Error %s:" % e.args[0])

# Airplay state check
def IsAirplayOn():
    global ButtonOverride
    AirplayOn = False
        cur = con.cursor()    
        cur.execute('select value from cfg_system where param=\'airplayactv\'')
        data = cur.fetchone()[0]    
        if (Debug): print("SQL = %s" % data)
        if data == "1":
            AirplayOn = True

    except SQLite3.Error as e:
        if (Debug): print("Error %s:" % e.args[0])

    if ButtonOverride:
        AirplayOn = False
    if Debug: print("Returning IsAirplayOn = {0}".format(AirplayOn))
    return AirplayOn

Is this still correct under Moode 7?

Forum Jump: