Commit e9acfa56 authored by Gottfried Gaisbauer's avatar Gottfried Gaisbauer
Browse files

disabled logging while fading. to many commands...

parent b1f590f2
......@@ -185,9 +185,11 @@ Well, this is - at least for me - a hard one. I could not manage to find correct
**If you experience 'hangs' or other artefacts on the output signal**
* reduce the quality (especially, when hangs are on the stream) or
* install the realtime kernel with
```bash
apt install linux-image-rt-amd64
reboot
```
or
* invest in better hardware
\ No newline at end of file
......@@ -43,7 +43,7 @@ class LiquidSoapClient:
logger = None
debug = False
socket_path = ""
enable_logging = True
disable_logging = True
def __init__(self, config, socket_filename):
"""
......@@ -196,19 +196,19 @@ class LiquidSoapClient:
message = str(namespace) + str(".") + str(command) + str(param) + str("\n")
try:
if self.enable_logging:
if not self.disable_logging:
self.logger.info("LiquidSoapClient sending to LiquidSoap Server: " + message[0:len(message)-1])
# send all the stuff over the socket to liquidsoap server
self.socket.sendall(message.encode())
if self.enable_logging:
if not self.disable_logging:
self.logger.debug("LiquidSoapClient waiting for reply from LiquidSoap Server")
# wait for reply
self.read()
if self.enable_logging:
if not self.disable_logging:
self.logger.info("LiquidSoapClient got reply: " + self.message)
except BrokenPipeError as e:
self.logger.error("Detected a problem with liquidsoap connection while sending: " + message + ". Reason: " + str(e) + "! Trying to reconnect.")
......
......@@ -53,6 +53,7 @@ class LiquidSoapCommunicator(ExceptionLogger):
is_liquidsoap_running = False
connection_attempts = 0
active_channel = None
disable_logging = False
# ------------------------------------------------------------------------------------------ #
def __init__(self, config):
......@@ -227,11 +228,15 @@ class LiquidSoapCommunicator(ExceptionLogger):
target_volume = new_entry.volume
step = seconds / target_volume
self.logger.info("Starting to fading " + new_entry.type.value + " in. step is " + str(step) + ". target volume is " + str(target_volume))
self.logger.info("Starting to fading " + new_entry.type.value + " in. step is " + str(step) + "s. target volume is " + str(target_volume))
self.disable_logging = True
for i in range(target_volume):
self.channel_volume(new_entry.type.value, i + 1)
time.sleep(step)
self.disable_logging = False
self.logger.info("Finished with fading " + new_entry.type.value + " in.")
return True
......@@ -239,12 +244,16 @@ class LiquidSoapCommunicator(ExceptionLogger):
def fade_out(self, old_entry, seconds):
step = abs(seconds) / old_entry.volume
self.logger.info("Starting to fading " + old_entry.type.value + " out. step is " + str(step))
self.logger.info("Starting to fading " + old_entry.type.value + " out. step is " + str(step) + "s")
# disable logging... it is going to be enabled again after fading in
self.disable_logging = True
for i in range(old_entry.volume):
self.channel_volume(old_entry.type.value, old_entry.volume-i-1)
time.sleep(step)
self.logger.info("Finished with fading " + old_entry.type.value + " out.")
return True
# ------------------------------------------------------------------------------------------ #
......@@ -390,20 +399,20 @@ class LiquidSoapCommunicator(ExceptionLogger):
channels = self.get_all_channels()
index = channels.index(channel)
except ValueError as e:
self.logger.error("Cannot set volume of channel " + channel + ". Reason: " + str(e))
self.logger.error("Cannot set volume of channel " + channel + " to " + str(volume) + "!. Reason: " + str(e))
return
try:
if len(channel) < 1:
self.logger.warning("Cannot set volume of channel " + channel + "! There are no channels.")
self.logger.warning("Cannot set volume of channel " + channel + " to " + str(volume) + "! There are no channels.")
else:
message = self.__send_lqc_command__(self.client, "mixer", "volume", str(index), str(int(volume)))
if message.find('volume=' + str(volume) + '%'):
self.logger.debug("Set volume of channel " + channel + " to " + str(volume))
else:
self.logger.warning("Setting volume of channel " + channel + " gone wrong! Liquidsoap message: " + message)
if not self.disable_logging:
if message.find('volume=' + str(volume) + '%'):
self.logger.debug("Set volume of channel " + channel + " to " + str(volume))
else:
self.logger.warning("Setting volume of channel " + channel + " gone wrong! Liquidsoap message: " + message)
return message
except AttributeError as e: #(LQConnectionError, AttributeError):
......@@ -475,20 +484,26 @@ class LiquidSoapCommunicator(ExceptionLogger):
@return: Response from LiquidSoap
"""
try:
if namespace == "recorder":
self.logger.info("LiquidSoapCommunicator is calling " + str(namespace) + "_" + str(command) + "." + str(args))
else:
if command == "":
self.logger.info("LiquidSoapCommunicator is calling " + str(namespace) + str(args))
if not self.disable_logging:
if namespace == "recorder":
self.logger.info("LiquidSoapCommunicator is calling " + str(namespace) + "_" + str(command) + "." + str(args))
else:
self.logger.info("LiquidSoapCommunicator is calling " + str(namespace) + "." + str(command) + str(args))
if command == "":
self.logger.info("LiquidSoapCommunicator is calling " + str(namespace) + str(args))
else:
self.logger.info("LiquidSoapCommunicator is calling " + str(namespace) + "." + str(command) + str(args))
else:
lqs_instance.disable_logging = True
# call wanted function ...
func = getattr(lqs_instance, namespace)
# ... and fetch the result
result = func(command, *args)
self.logger.debug("LiquidSoapCommunicator got response " + str(result))
if not self.disable_logging:
self.logger.debug("LiquidSoapCommunicator got response " + str(result))
else:
lqs_instance.disable_logging = False
self.connection_attempts = 0
......
......@@ -179,7 +179,7 @@ class ServerRedisAdapter(threading.Thread, RedisMessenger):
elif item["data"].find("set_next_file") >= 0:
playlist = item["data"].split()[1]
playlist = playlist[0:len(playlist)-9]
playlist = playlist[0:len(playlist)-8]
self.execute(RedisChannel.SNF_REPLY.value, self.scheduler.set_next_file_for, playlist)
elif item["data"] == "recreate_db":
......
......@@ -173,7 +173,7 @@ class AuraScheduler(ExceptionLogger, threading.Thread):
for entry in self.programme:
# check if lastentry is set and if act entry is in the future
if lastentry is not None and entry.entry_start_unix > now_unix:
# return lastentry if so
# return entry if so
return entry # actsource = entry.source
lastentry = entry
......@@ -204,7 +204,7 @@ class AuraScheduler(ExceptionLogger, threading.Thread):
# when do we have to start?
diff = entry.entry_start_unix - now_unix
diff = diff/100 # testing purpose
diff = diff/1000 # testing purpose
self.enable_fading(fade_in_time, fade_out_time, old_entry, entry, diff)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment