Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


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

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


# Airplay state check
def IsAirplayOn():
    
    global ButtonOverride
    
    AirplayOn = False
    try:
        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?
Reply


Forum Jump: