Beispiel #1
0
def __autoconfig():
    '''
        If the user hasn't used our plugin before, then try to
        autoconfig their audio settings to use a different audio
        device if possible.. 
        
        TODO: It would be cool if we could notify the user that
        a new device was plugged in...
    '''

    from xl import settings

    if settings.get_option('preview_device/audiosink', None) is not None:
        return

    sink = settings.get_option('player/audiosink', None)
    if sink is None:
        return

    settings.set_option('preview_device/audiosink', sink)

    main_device = settings.get_option('player/audiosink_device', None)
    if main_device is None:
        return

    from xl.player import pipe
    devices = pipe.sink_enumerate_devices(sink)
    if devices is not None:
        # pick the first one that isn't the main device and isn't 'Auto'
        # -> if the main device is '', then it's auto. So... we actually
        # iterate backwards, assuming that the ordering matters
        for device, name in reversed(devices):
            if device != main_device and name != _('Auto'):
                settings.set_option('preview_device/audiosink_device', device)
                break
Beispiel #2
0
def __autoconfig():
    '''
        If the user hasn't used our plugin before, then try to
        autoconfig their audio settings to use a different audio
        device if possible.. 
        
        TODO: It would be cool if we could notify the user that
        a new device was plugged in...
    '''
    
    from xl import settings

    if settings.get_option('preview_device/audiosink', None) is not None:
        return
        
    sink = settings.get_option('player/audiosink', None)    
    if sink is None:
        return
        
    settings.set_option( 'preview_device/audiosink', sink )
    
    main_device = settings.get_option('player/audiosink_device', None)
    if main_device is None:
        return
    
    from xl.player import pipe
    devices = pipe.sink_enumerate_devices(sink)
    if devices is not None:
        # pick the first one that isn't the main device and isn't 'Auto'
        # -> if the main device is '', then it's auto. So... we actually
        # iterate backwards, assuming that the ordering matters
        for device,name in reversed(devices):
            if device != main_device and name != _('Auto'):
                settings.set_option( 'preview_device/audiosink_device', device )
                break
Beispiel #3
0
    def on_check_condition(self):
        iter = self.condition_widget.get_active_iter()
        value = self.condition_widget.get_model().get_value(iter, 0)

        devices = pipe.sink_enumerate_devices(value)
        if devices:
            # disable because the clear() causes a settings write
            self.is_enabled = False

            model = self.widget.get_model()
            model.clear()

            for device in devices:
                model.append(device)

            self.is_enabled = True
            self._set_value()
            return True

        self.is_enabled = False
        return False
Beispiel #4
0
    def on_check_condition(self):
        iter = self.condition_widget.get_active_iter()
        value = self.condition_widget.get_model().get_value(iter, 0)        

        devices = pipe.sink_enumerate_devices(value)
        if devices:
            # disable because the clear() causes a settings write
            self.is_enabled = False

            model = self.widget.get_model()
            model.clear()

            for device in devices:
                model.append(device) 

            self.is_enabled = True
            self._set_value()
            return True

        self.is_enabled = False
        return False