예제 #1
0
파일: rfwr.py 프로젝트: vsxed/rf.wr.py
def ctct():
    __active_zoneLock.acquire()

    # Get Volume
    current_volume = str(active_zone.volume)

    # Get zones if zone management is turned on
    if zones_on:
        zones = raumfeld.getZones()
        active_zone_str_helper = [active_zone_udn == zone.UDN for zone in zones]
        active_zone_str_helper = [re.sub('True', 'Active', str(no)) for no in active_zone_str_helper]
        active_zone_str_helper = [re.sub('False', 'Activate', str(no)) for no in active_zone_str_helper]
        unassigned = raumfeld.getUnassignedRooms()

    else:
        active_zone_str_helper = []
        zones = []
        unassigned = []

    sleep(1)
    TState = str(active_zone.transport_state)
    if str(TState) == "STOPPED" or str(TState) == "PAUSED_PLAYBACK":
            play_button = 'play_shiny.png'
    else:
            play_button = 'pause_shiny.png'

    __active_zoneLock.release()

    return template('controls', play_button=play_button, zones_on=zones_on, zones=zones, unassigned=unassigned, active_zone_str_helper=active_zone_str_helper, current_volume=current_volume)
예제 #2
0
def getUnassignedRooms():
    """Returns the unassigned room names and UDNs in JSON format"""
    returndata = {}
    returndata["data"] = []
    returndata["success"] = False
    for room in raumfeld.getUnassignedRooms():
        r = {}
        r['name'] = room.Name
        r['udn'] = room.UDN
        returndata["data"].append(r)
        returndata["success"] = True
    return json.dumps(returndata)
예제 #3
0
def getUnassignedRooms():
    """Returns the unassigned room names and UDNs in JSON format"""
    returndata = {}
    returndata["data"] = []
    returndata["success"] = False
    for room in raumfeld.getUnassignedRooms():
        r = {}
        r['name'] = room.Name
        r['udn'] = room.UDN
        returndata["data"].append(r)
        returndata["success"] = True
    return json.dumps(returndata)
예제 #4
0
def dataHasBeenUpdated():
    print("########## " + strftime("%Y-%m-%d %H:%M:%S", gmtime()) + " ##########")
    print("Zones:")
    for zone in raumfeld.getZones():
        print("UDN: " + zone.UDN + " Name: " + zone.Name + " Location: " + zone.Location)
        for room in zone.getRooms():
            print("\tUDN: " + room.UDN + " Name: " + room.Name)
            for renderer in room.getRenderers():
                print("\t\tUDN: " + renderer.UDN + " Name: " + renderer.Name + " Location: " + renderer.Location + " Volume: " + unicode(renderer.volume))
     
    print("Unassigned Rooms:")
    for room in raumfeld.getUnassignedRooms():
        print("Name: " + room.Name + " UDN: " + room.UDN)
        for renderer in room.getRenderers():
            print("\tUDN: " + renderer.UDN + " Name: " + renderer.Name + " Location: " + renderer.Location)
    print("########## This gets updated when the config changes. To QUIT press any key... ##########")
예제 #5
0
파일: rfwr.py 프로젝트: vsxed/rf.wr.py
def info():
        __active_zoneLock.acquire()

        zones = raumfeld.getZones()
        active_zone_str_helper = [active_zone_udn == zone.UDN for zone in zones]
        active_zone_str_helper = [re.sub('True', 'Active', str(no)) for no in active_zone_str_helper]
        active_zone_str_helper = [re.sub('False', 'Activate', str(no)) for no in active_zone_str_helper]
        unassigned = raumfeld.getUnassignedRooms()

        current_track = active_zone.position_info
        current_media = active_zone.media_info

        track_raw = unicode(current_track['track_metadata']).encode('utf8')
        tree = ET.fromstring(track_raw)
        track_meta = didl_to_dict(tree)[0]
        tree = ET.fromstring(unicode(current_track['track_metadata']).encode('utf8'))
        media_meta = didl_to_dict(tree)[0]
        host_address = raumfeld.hostBaseURL
        host_ip = re.findall( r'[0-9]+(?:\.[0-9]+){3}', host_address)[0]

        __active_zoneLock.release()
        return template('info', zones=zones, unassigned=unassigned, active_zone_str_helper=active_zone_str_helper, track_meta = track_meta, media_meta = media_meta, host_ip = host_ip)
예제 #6
0
def dataHasBeenUpdated():
    print("########## " + strftime("%Y-%m-%d %H:%M:%S", gmtime()) +
          " ##########")
    print("Zones:")
    for zone in raumfeld.getZones():
        print("UDN: " + zone.UDN + " Name: " + zone.Name + " Location: " +
              zone.Location)
        for room in zone.getRooms():
            print("\tUDN: " + room.UDN + " Name: " + room.Name)
            for renderer in room.getRenderers():
                print("\t\tUDN: " + renderer.UDN + " Name: " + renderer.Name +
                      " Location: " + renderer.Location + " Volume: " +
                      unicode(renderer.volume))

    print("Unassigned Rooms:")
    for room in raumfeld.getUnassignedRooms():
        print("Name: " + room.Name + " UDN: " + room.UDN)
        for renderer in room.getRenderers():
            print("\tUDN: " + renderer.UDN + " Name: " + renderer.Name +
                  " Location: " + renderer.Location)
    print(
        "########## This gets updated when the config changes. To QUIT press any key... ##########"
    )
예제 #7
0
inp = ''
while inp == '':
    print("Zones:")
    for zone in raumfeld.getZones():
        print("UDN: " + zone.UDN + " Name: " + zone.Name + " Location: " +
              zone.Location)
        for room in zone.getRooms():
            print("\tUDN: " + room.UDN + " Name: " + room.Name)
            for renderer in room.getRenderers():
                print("\t\tUDN: " + renderer.UDN + " Name: " + renderer.Name +
                      " Location: " + renderer.Location + " Volume: " +
                      unicode(renderer.volume))

    print("Unassigned Rooms:")
    for room in raumfeld.getUnassignedRooms():
        print("Name: " + room.Name + " UDN: " + room.UDN)
        for renderer in room.getRenderers():
            print("\tUDN: " + renderer.UDN + " Name: " + renderer.Name +
                  " Location: " + renderer.Location)

    #kueche = raumfeld.getRoomsByName(u'Küche')[0]
    #kuecheZone = raumfeld.getZoneWithRoomName(u'Wohnzimmer')[0]
    #status = kuecheZone.mute
    #print("Mute: {0}".format(status))
    #kueche.mute = not status
    #kuecheZone.play()
    #print("Volume: {0}".format(kuecheZone.volume))

    #raumfeld.connectRoomToZone(kueche.UDN)
    inp = raw_input("prompt")