From 4c7bf9aae951c97d26f54326cf42cde0d27ac717 Mon Sep 17 00:00:00 2001 From: David Trattnig <david.trattnig@o94.at> Date: Fri, 18 Sep 2020 19:52:41 +0200 Subject: [PATCH] Correct assignment of live channels. #3 --- modules/core/engine.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/modules/core/engine.py b/modules/core/engine.py index 255d7ee3..ffa463be 100644 --- a/modules/core/engine.py +++ b/modules/core/engine.py @@ -212,7 +212,8 @@ class SoundSystem(): # LIVE if entry.get_type() == ChannelType.LIVE: - entry.channel = "linein_" + entry.source.split("line://")[1] + channel_num = entry.source.split("line://")[1] + entry.channel = Channel["LIVE_"+channel_num] is_ready = True else: # Choose and save the input channel @@ -303,17 +304,18 @@ class SoundSystem(): self.active_channel[entry.get_type()] = entry.channel # Dear filesystem channels, please leave the room as you would like to find it! - if entry.previous_channel and entry.previous_channel in ChannelType.FILESYSTEM.channels: - def clean_up(): - # Wait a little, if there is some long fade-out. Note, this also means, - # this channel should not be used for at least some seconds (including clearing time). - time.sleep(2) - self.enable_transaction() - self.channel_activate(entry.previous_channel.value, False) - res = self.playlist_clear(entry.previous_channel) - self.logger.info("Clear Queue Response: " + res) - self.disable_transaction() - Thread(target=clean_up).start() + if hasattr(entry, "previous_channel"): + if entry.previous_channel in ChannelType.FILESYSTEM.channels: + def clean_up(): + # Wait a little, if there is some long fade-out. Note, this also means, + # this channel should not be used for at least some seconds (including clearing time). + time.sleep(2) + self.enable_transaction() + self.channel_activate(entry.previous_channel.value, False) + res = self.playlist_clear(entry.previous_channel) + self.logger.info("Clear Queue Response: " + res) + self.disable_transaction() + Thread(target=clean_up).start() # Filesystem meta-changes trigger the event via Liquidsoap if not entry.channel in ChannelType.FILESYSTEM.channels: -- GitLab