Skip to content
Snippets Groups Projects
Commit bc095ab3 authored by David Trattnig's avatar David Trattnig
Browse files

Added clear queue and queue playlist.

parent 155d8b56
No related branches found
No related tags found
No related merge requests found
......@@ -323,6 +323,62 @@ class LiquidSoapCommunicator(ExceptionLogger):
pass
def activate_playlist(self, playlist, cue_in=0.0):
"""
Activates a new Playlist.
Args:
new_entry (Playlist): The playlist to be played
Raises:
(LQConnectionError): In case connecting to LiquidSoap isn't possible
"""
# Grab the actual active entry
active_entry = self.scheduler.get_active_entry()
# Set default channel, if no previous track is available
current_channel = ScheduleEntryType.FILESYSTEM
if active_entry:
current_channel = active_entry.type
try:
# FIXME clearing creates some serious timing issues
# To activate this feature we'd need some more sophisticated
# Liquidsoap logic, such as >= 2 filesystem channels and
# possiblities to pause pre-queued channels or cleaning them
# after each completed schedule.
# self.enable_transaction()
# #if active_entry:
# #self.fade_out(active_entry)
# res = self.clear_queue()
# self.logger.info("Clear Queue Response: "+res)
# self.disable_transaction()
self.enable_transaction()
self.reload_channels()
# self.fade_in(playlist.entries[0])
for new_entry in playlist.entries:
if current_channel == new_entry.type:
self.activate_same_channel(new_entry, cue_in)
else:
self.activate_different_channel(new_entry, cue_in, current_channel)
current_channel = new_entry.type
self.disable_transaction()
# FIXME Implement TrackService bi-directionally, log fallbacks too.
self.logger.critical("FIXME: Implement TrackService")
# self.insert_track_service_entry(new_entry)
except LQConnectionError:
# we already caught and handled this error in __send_lqc_command__,
# but we do not want to execute this function further and pass the exception
pass
def activate_same_channel(self, entry, cue_in=0.0, activate_different_channel=False):
"""
Activates a playlist entry for the current channel.
......@@ -380,6 +436,17 @@ class LiquidSoapCommunicator(ExceptionLogger):
# Set active channel to wanted volume
self.channel_volume(entry.type.value, entry.volume)
def clear_queue(self):
"""
Removes all tracks currently queued.
"""
self.logger.info(TerminalColors.PINK.value + "LiquidSoapCommunicator is clearing the filesystem queue!" + TerminalColors.ENDC.value)
return self.__send_lqc_command__(self.client, "fs", "clear", )
# ------------------------------------------------------------------------------------------ #
def insert_track_service_entry(self, schedule_entry):
# create trackservice entry
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment