Revert "Fixed sound.py when there are multiple sessions trying to load the library"

This reverts commit 80f2e8f984.
This commit is contained in:
Jose Manuel Delicado 2017-07-19 15:23:34 +02:00
parent 20d4023e58
commit 7997f23f9c

View File

@ -22,8 +22,6 @@ import tempfile
import glob import glob
URLPlayer = None URLPlayer = None
is_created = False
def setup(): def setup():
global URLPlayer global URLPlayer
if not URLPlayer: if not URLPlayer:
@ -60,17 +58,14 @@ class soundSystem(object):
def __init__(self, soundConfig): def __init__(self, soundConfig):
""" Sound Player.""" """ Sound Player."""
global is_created
self.config = soundConfig self.config = soundConfig
# Set the output and input default devices. # Set the output and input default devices.
if is_created == False:
try: try:
self.output = Output() self.output = Output()
self.input = Input() self.input = Input()
except IOError: except IOError:
pass pass
# Try to use the selected device from the configuration. It can fail if the machine does not has a mic. # Try to use the selected device from the configuration. It can fail if the machine does not has a mic.
if is_created == False:
try: try:
log.debug("Setting input and output devices...") log.debug("Setting input and output devices...")
self.output.set_device(self.output.find_device_by_name(self.config["output_device"])) self.output.set_device(self.output.find_device_by_name(self.config["output_device"]))
@ -79,7 +74,7 @@ class soundSystem(object):
log.exception("Error in input or output devices, using defaults...") log.exception("Error in input or output devices, using defaults...")
self.config["output_device"] = "Default" self.config["output_device"] = "Default"
self.config["input_device"] = "Default" self.config["input_device"] = "Default"
is_created = True
self.files = [] self.files = []
self.cleaner = RepeatingTimer(60, self.clear_list) self.cleaner = RepeatingTimer(60, self.clear_list)
self.cleaner.start() self.cleaner.start()