Exemplo n.º 1
0
    def __init__(self):
        """ Sound Player."""
        # Set the output and input default devices.
        self.output = sound_lib.output.Output()
        self.input = sound_lib.input.Input()
        # Try to use the selected device from the configuration. It can fail if the machine does not has a mic.
        try:
            self.output.set_device(
                self.output.find_device_by_name(
                    config.main["sound"]["output_device"]))
            self.input.set_device(
                self.input.find_device_by_name(
                    config.main["sound"]["input_device"]))
        except:
            config.main["sound"]["output_device"] = "Default"
            config.main["sound"]["input_device"] = "Default"

        self.files = []
        self.cleaner = RepeatingTimer(60, self.clear_list)
        self.cleaner.start()
        self.check_soundpack()
Exemplo n.º 2
0
 def __init__(self, soundConfig):
  """ Sound Player."""
  self.config = soundConfig
  # Set the output and input default devices.
  try:
   self.output = sound_lib.output.Output()
   self.input = sound_lib.input.Input()
  except:
   pass
   # Try to use the selected device from the configuration. It can fail if the machine does not has a mic.
  try:
   log.debug("Setting input and output devices...")
   self.output.set_device(self.output.find_device_by_name(self.config["output_device"]))
   self.input.set_device(self.input.find_device_by_name(self.config["input_device"]))
  except:
   log.error("Error in input or output devices, using defaults...")
   self.config["output_device"] = "Default"
   self.config["input_device"] = "Default"

  self.files = []
  self.cleaner = RepeatingTimer(60, self.clear_list)
  self.cleaner.start()
  self.check_soundpack()