コード例 #1
0
def fuzzydevices(match='', min_ratio=30):
    device_ratios = []
    for device in device_info():
        ratio = fuzz.partial_ratio(match, device['name'])
        if ratio > min_ratio:
            device_ratios.append((ratio, device))

    for ratio, device in sorted(device_ratios, key=lambda ratio_device: (ratio_device[0])):
        yield device
コード例 #2
0
def getDevices(kind=None):
    """Returns a dict of dict of audio devices of sepcified `kind`

    The dict keys are names and items are dicts of properties
    """
    devs = {}
    for ii, dev in enumerate(soundcard.device_info()):
        if (dev['max_output_channels']==0 and kind=='output' or
                dev['max_input_channels']==0 and kind=='input'):
            continue
        devs[dev['name']] = dev
        dev['id'] = ii
    return devs
コード例 #3
0
def getDevices(kind=None):
    """Returns a dict of dict of audio devices of sepcified `kind`

    The dict keys are names and items are dicts of properties
    """
    devs = {}
    for ii, dev in enumerate(soundcard.device_info()):
        if (dev['max_output_channels'] == 0 and kind == 'output'
                or dev['max_input_channels'] == 0 and kind == 'input'):
            continue
        devs[dev['name']] = dev
        dev['id'] = ii
    return devs
コード例 #4
0
def getDevices(kind=None):
    """Returns a dict of dict of audio devices of specified `kind`

    The dict keys are names and items are dicts of properties
    """
    devs = {}
    for ii, dev in enumerate(soundcard.device_info()):
        if (dev['max_output_channels']==0 and kind=='output' or
                dev['max_input_channels']==0 and kind=='input'):
            continue
        # newline characters must be removed
        devName = dev['name'].replace('\r\n','')
        devs[devName] = dev
        dev['id'] = ii
    return devs