Esempio n. 1
0
pair = False

lock = Lock()

try:
    vlc = VLCClient(vlc_host)
    vlc.connect()
except:
    print("Cannot connect to vlc instance, check whether vlc is running or telnet interface is enabled")
    print("Error: " + str(sys.exc_info()))
    exit(1)

try:
    pebble = libpebble.Pebble(pebble_id, using_lightblue=lightblue, pair_first=pair)
except:
    vlc.disconnect();
    print("Cannot connect to pebble, check whether bluetooth is enabled in here and pebble")
    print("Error: " + str(sys.exc_info()))
    exit(1)

state = "stopped"
up_down_button_mode = 'slider'

def update_metadata():
    global state
    with lock:
        status = vlc.status()
        if len(status.split(')')) > 3:
            movie = status.split(')')[0].split(':')[-1].split('/')[-1]
            volume = status.split(')')[1].split(':')[-1]
            #bug in vlc/vlc-client, not correct status is returned, rely manual status