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

Smooth fade-out of scheduled fb. #44

parent e161db7c
No related branches found
No related tags found
No related merge requests found
......@@ -22,6 +22,7 @@
import logging
from enum import Enum
from datetime import timedelta
from modules.base.config import AuraConfig
from modules.base.utils import SimpleUtil as SU
......@@ -219,5 +220,9 @@ class FallbackCommand(EngineExecutor):
self.logger.info(SU.cyan("=== stop_fallback_playlist() ==="))
Engine.get_instance().player.stop_fallback_playlist()
child_timer = EngineExecutor("FALLBACK", None, timeslot.end_unix, do_stop, None)
# Start fade-out 50% before the end of the timeslot for a more smooth transition
end_time_offset = int(float(AuraConfig.config().get("fade_out_time")) / 2 * 1000 * -1)
end_time = SU.timestamp(timeslot.schedule_end + timedelta(milliseconds=end_time_offset))
self.logger.info(f"Starting fade-out of scheduled fallback with an offset of {end_time_offset} milliseconds at {end_time}")
child_timer = EngineExecutor("FALLBACK", None, end_time, do_stop, None)
super().__init__("FALLBACK", child_timer, timeslot.start_unix, do_play, entries)
\ No newline at end of file
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