diff --git a/Makefile b/Makefile index b3bcb104cd1d91dfff2e252fda4f1f403363860a..9bf15d0200715961a2fb300ed68228e4085ae343 100644 --- a/Makefile +++ b/Makefile @@ -76,7 +76,7 @@ db.connect:: PGHOST=127.0.0.1 PGPORT=5432 PGUSER=aura_engine PGPASSWORD=1234 PGDATABASE=aura_engine psql log:: - tail -f logs/AuraEngine.log + tail -f logs/engine.log run:: poetry run python3 -m aura_engine.app diff --git a/src/aura_engine/app.py b/src/aura_engine/app.py index 36c49168514a5740a21e9b2bba64b1f7dea95ec7..4e7ef020c1898c84575693924d18788bd4fe0980 100755 --- a/src/aura_engine/app.py +++ b/src/aura_engine/app.py @@ -66,7 +66,7 @@ class EngineRunner: """ self.config = config AuraLogger(self.config) - self.logger = logging.getLogger("AuraEngine") + self.logger = logging.getLogger("engine") def run(self): """ diff --git a/src/aura_engine/base/api.py b/src/aura_engine/base/api.py index 790303b6eaf125333bdbb463a06178841f04ecc8..2815b39eb54b97f5f5e5b65cebba2a387d9b4571 100644 --- a/src/aura_engine/base/api.py +++ b/src/aura_engine/base/api.py @@ -70,7 +70,7 @@ class SimpleApi: handling but with results only. SimpleApi has implicit logging of invalid states at logs - to the `AuraEngine` logger by default. + to the `engine` logger by default. """ CONTENT_JSON = "application/json" @@ -78,7 +78,7 @@ class SimpleApi: logger = None - def __init__(self, logger_name="AuraEngine"): + def __init__(self, logger_name="engine"): self.logger = logging.getLogger(logger_name) def exception_handler(func): diff --git a/src/aura_engine/base/config.py b/src/aura_engine/base/config.py index ed5c6b51732ca5cc83a49272d70d1c280d196531..72211f940bfb83820c41a15899ace3755748c147 100644 --- a/src/aura_engine/base/config.py +++ b/src/aura_engine/base/config.py @@ -49,7 +49,7 @@ class AuraConfig: ini_path(String): The path to the configuration file `engine.ini` """ - self.logger = logging.getLogger("AuraEngine") + self.logger = logging.getLogger("engine") config_file = Path(ini_path) project_root = Path(__file__).parent.parent.parent.parent.absolute() diff --git a/src/aura_engine/base/logger.py b/src/aura_engine/base/logger.py index 206a38b722a2082df0cb6e553c2d424c8135010d..a86ebc7d4795da7b784e071f03335d184b78463b 100644 --- a/src/aura_engine/base/logger.py +++ b/src/aura_engine/base/logger.py @@ -36,7 +36,7 @@ class AuraLogger: config = None logger = None - def __init__(self, config, name="AuraEngine"): + def __init__(self, config, name="engine"): """ Initialize the logger. diff --git a/src/aura_engine/control.py b/src/aura_engine/control.py index 035bc38bd2c66f51be9287c848f393aaf1ff6722..c70937a6f7f3874a5d7a6dca20b000ef3efd5867 100644 --- a/src/aura_engine/control.py +++ b/src/aura_engine/control.py @@ -38,7 +38,7 @@ class EngineExecutor(Timer): """ timer_store: dict = {} - logger = logging.getLogger("AuraEngine") + logger = logging.getLogger("engine") _lock = None direct_exec: bool = None @@ -48,7 +48,7 @@ class EngineExecutor(Timer): timer_id: str = None timer_type: str = None update_count: int = None - func: func = None + func = None param = None diff = None dt = None @@ -193,7 +193,6 @@ class EngineExecutor(Timer): existing_command = EngineExecutor.timer_store[self.timer_id] if existing_command: - # Check if existing timer has been executed already -> don't update if not existing_command.is_alive(): msg = f"Existing dead timer (ID: {self.timer_id}) - no update." diff --git a/src/aura_engine/core/channels.py b/src/aura_engine/core/channels.py index fc420e39539232bd7acd8dab4ef674cfcc8f56f3..6336bf12858b82d0d9dd3aef7bbf1855ef72ef6d 100644 --- a/src/aura_engine/core/channels.py +++ b/src/aura_engine/core/channels.py @@ -149,7 +149,7 @@ class GenericChannel: """ self.config = AuraConfig.config() - self.logger = logging.getLogger("AuraEngine") + self.logger = logging.getLogger("engine") self.mixer = mixer self.name = channel_name self.index = channel_index @@ -577,7 +577,7 @@ class ChannelFactory: """ self.config = AuraConfig() - self.logger = logging.getLogger("AuraEngine") + self.logger = logging.getLogger("engine") self.mixer = mixer def create_channel(self, channel_index, channel_name: ChannelName, mixer) -> GenericChannel: diff --git a/src/aura_engine/core/client.py b/src/aura_engine/core/client.py index ac16dcbd483ddb65d28c9db8b17ead029cf82cfd..f2482b177d9c18b0c0c2c160dec67ce40856d71e 100644 --- a/src/aura_engine/core/client.py +++ b/src/aura_engine/core/client.py @@ -49,7 +49,7 @@ class CoreClient: """ Initialize the client. """ - self.logger = logging.getLogger("AuraEngine") + self.logger = logging.getLogger("engine") self.config = AuraConfig.config() self.event_dispatcher = event_dispatcher self.conn = CoreConnection() @@ -235,7 +235,7 @@ class CoreConnection: """ Initialize the connection. """ - self.logger = logging.getLogger("AuraEngine") + self.logger = logging.getLogger("engine") config = AuraConfig.config() socket_path = config.get("socket_dir") + "/engine.sock" self.socket_path = config.to_abs_path(socket_path) diff --git a/src/aura_engine/core/mixer.py b/src/aura_engine/core/mixer.py index 03c09ea2624a433f35ef2a76854169bc780900e7..83022296781e1755f9c69c08ea53f767db173f69 100644 --- a/src/aura_engine/core/mixer.py +++ b/src/aura_engine/core/mixer.py @@ -64,7 +64,7 @@ class Mixer: """ self.config = AuraConfig.config() - self.logger = logging.getLogger("AuraEngine") + self.logger = logging.getLogger("engine") self.mixer_id = mixer_id self.client = client self.channel_names = [] @@ -312,7 +312,6 @@ class Mixer: return idx if not self.channel_names: - # Get channel names channel_names = self.client.exec(self.mixer_id, "inputs") channel_names = channel_names.split(" ") diff --git a/src/aura_engine/engine.py b/src/aura_engine/engine.py index c77f4d36862dbaf78e0c603f0acf5187094d776d..dbe13066cf4c8e944fd233d4e90a4214eb9fc3b1 100644 --- a/src/aura_engine/engine.py +++ b/src/aura_engine/engine.py @@ -65,7 +65,7 @@ class Engine: if Engine.instance: raise Exception("Engine is already running!") Engine.instance = self - self.logger = logging.getLogger("AuraEngine") + self.logger = logging.getLogger("engine") self.config = AuraConfig.config() Engine.engine_time_offset = float(self.config.get("engine_latency_offset")) self.start() @@ -261,7 +261,7 @@ class Player: """ self.config = AuraConfig.config() - self.logger = logging.getLogger("AuraEngine") + self.logger = logging.getLogger("engine") self.event_dispatcher = event_dispatcher self.resource_map = ResourceMapping() self.mixer = playout.get_mixer() @@ -379,7 +379,6 @@ class Player: """ with suppress(CoreConnectionError): - # Stop any active channel self.stop(Player.TransitionType.FADE) diff --git a/src/aura_engine/events.py b/src/aura_engine/events.py index 10d5b32ddba439c410eb72cf8348f74a9f8f72d7..5e3a5ad8eb5e4a44f4f88c3f2b94832dcf72b759 100644 --- a/src/aura_engine/events.py +++ b/src/aura_engine/events.py @@ -85,7 +85,7 @@ class EngineEventDispatcher: Initialize the event dispatcher. """ self.subscriber_registry = dict() - self.logger = logging.getLogger("AuraEngine") + self.logger = logging.getLogger("engine") self.config = AuraConfig.config() self.engine = engine diff --git a/src/aura_engine/plugins/clock.py b/src/aura_engine/plugins/clock.py index 3ad8d327a75c928ee6bc2fc77824bdbdb869369b..c23096fa9ca61788e9a30f6ef57d6e9ca5f4acb7 100644 --- a/src/aura_engine/plugins/clock.py +++ b/src/aura_engine/plugins/clock.py @@ -44,7 +44,7 @@ class ClockInfoHandler: """ Initialize. """ - self.logger = logging.getLogger("AuraEngine") + self.logger = logging.getLogger("engine") self.config = AuraConfig.config() self.api = SimpleApi() self.engine = engine diff --git a/src/aura_engine/plugins/mailer.py b/src/aura_engine/plugins/mailer.py index 2500e6bc7c6ef59bd14212f1d1e29e0bffbf488f..5e0598bebff5bacf1541917b75977731575fb149 100644 --- a/src/aura_engine/plugins/mailer.py +++ b/src/aura_engine/plugins/mailer.py @@ -46,7 +46,7 @@ class AuraMailer: previous_timeslot = None def __init__(self, engine): - self.logger = logging.getLogger("AuraEngine") + self.logger = logging.getLogger("engine") self.engine = engine self.mail = MailService() @@ -121,7 +121,7 @@ class MailService: def __init__(self): self.config = AuraConfig.config() - self.logger = logging.getLogger("AuraEngine") + self.logger = logging.getLogger("engine") self.admin_mails = self.config.get("admin_mail") self.admin_mails_enabled = self.config.get("mail_admin_enabled") self.coordinator_mails = self.config.get("coordinator_mail") diff --git a/src/aura_engine/plugins/monitor.py b/src/aura_engine/plugins/monitor.py index 2c73301f4408b71f5017ff1400288fdb338e5a1a..97fad16b62c8d3120879b2c426fd2f890635a961 100644 --- a/src/aura_engine/plugins/monitor.py +++ b/src/aura_engine/plugins/monitor.py @@ -87,7 +87,7 @@ class AuraMonitor: """ Initialize Monitoring. """ - self.logger = logging.getLogger("AuraEngine") + self.logger = logging.getLogger("engine") self.config = AuraConfig.config() self.engine = engine self.status = dict() diff --git a/src/aura_engine/scheduling/api.py b/src/aura_engine/scheduling/api.py index b5ec16bcd961e80820ebdb83c0deb46acb7f84c2..ac4f012b82caf63341de797c4ce01671b4482b96 100644 --- a/src/aura_engine/scheduling/api.py +++ b/src/aura_engine/scheduling/api.py @@ -67,7 +67,7 @@ class ApiFetcher(threading.Thread): Initialize the API Fetcher. """ self.config = AuraConfig.config() - self.logger = logging.getLogger("AuraEngine") + self.logger = logging.getLogger("engine") self.api = SimpleApi() self.url_api_timeslots = self.config.get("api_steering_calendar") self.url_api_playlist = self.config.get("api_tank_playlist") diff --git a/src/aura_engine/scheduling/models.py b/src/aura_engine/scheduling/models.py index ff7210483beae1f1fd397d3b8555b0c3a2b4d8b4..6b4b7f225dd727b128b7d15c3d64dc2c525e5de2 100644 --- a/src/aura_engine/scheduling/models.py +++ b/src/aura_engine/scheduling/models.py @@ -90,7 +90,7 @@ class AuraDatabaseModel: logger = None def __init__(self): - self.logger = logging.getLogger("AuraEngine") + self.logger = logging.getLogger("engine") def store(self, add=False, commit=False): """ diff --git a/src/aura_engine/scheduling/programme.py b/src/aura_engine/scheduling/programme.py index a1d634464f19faa64698c4863c4093b57bce3d67..dac71650fa60090af41a50d291d4f9942ff47312 100644 --- a/src/aura_engine/scheduling/programme.py +++ b/src/aura_engine/scheduling/programme.py @@ -51,7 +51,7 @@ class ProgrammeService: def __init__(self): self.config = AuraConfig.config() - self.logger = logging.getLogger("AuraEngine") + self.logger = logging.getLogger("engine") self.programme_store = ProgrammeStore() def refresh(self): @@ -220,7 +220,6 @@ class ProgrammeService: timeslot.start_unix - window_start < now_unix and timeslot.start_unix - window_end > now_unix ): - return True return False @@ -249,7 +248,7 @@ class ProgrammeStore: def __init__(self): self.config = AuraConfig.config() - self.logger = logging.getLogger("AuraEngine") + self.logger = logging.getLogger("engine") self.m3u_processor = M3UPlaylistProcessor() def load_timeslots(self): @@ -277,7 +276,6 @@ class ProgrammeStore: # Process fetched timeslots for timeslot in fetched_timeslots: - # Store the timeslot timeslot_db = self.store_timeslot(timeslot) timeslots.append(timeslot_db) @@ -318,10 +316,8 @@ class ProgrammeStore: local_timeslots = Timeslot.get_timeslots(datetime.now()) for local_timeslot in local_timeslots: - # Ignore timeslots which have already started if local_timeslot.start_unix > now_unix: - # Filter the local timeslot from the fetched ones existing_remotely = list( filter( diff --git a/src/aura_engine/scheduling/scheduler.py b/src/aura_engine/scheduling/scheduler.py index fbc2cac5402b79be1fe1241513c0d43a617b8820..0fabb86fc8c60ee848bf5bf62fbc74d75501bea0 100644 --- a/src/aura_engine/scheduling/scheduler.py +++ b/src/aura_engine/scheduling/scheduler.py @@ -64,7 +64,7 @@ class AuraScheduler(threading.Thread): def __init__(self, engine): self.config = AuraConfig.config() - self.logger = logging.getLogger("AuraEngine") + self.logger = logging.getLogger("engine") self.programme = ProgrammeService() self.timeslot_renderer = TimeslotRenderer(self) self.engine = engine @@ -190,7 +190,6 @@ class AuraScheduler(threading.Thread): # In case of a file-system source, we need to fast-foward to the current marker as per # timeslot if active_entry.get_content_type() in ResourceClass.FILE.types: - # Calculate the seconds we have to fast-forward now_unix = Engine.engine_time() seconds_to_roll = now_unix - active_entry.start_unix @@ -225,7 +224,6 @@ class AuraScheduler(threading.Thread): active_entry.get_content_type() in ResourceClass.STREAM.types or active_entry.get_content_type() in ResourceClass.LIVE.types ): - # Preload and play active entry PlayCommand(self.engine, [active_entry]) @@ -350,7 +348,6 @@ class AuraScheduler(threading.Thread): previous_entry.get_content_type() == entry.get_content_type() and entry.get_content_type() in ResourceClass.FILE.types ): - entry_groups[index].append(entry) else: index += 1 diff --git a/src/aura_engine/scheduling/utils.py b/src/aura_engine/scheduling/utils.py index bbc1495437200e92b6663ee5c3881246bfa5fb25..c396fe0ceefa355d866299a304353cdaa7992021 100644 --- a/src/aura_engine/scheduling/utils.py +++ b/src/aura_engine/scheduling/utils.py @@ -120,7 +120,7 @@ class M3UPlaylistProcessor: def __init__(self): self.config = AuraConfig.config() - self.logger = logging.getLogger("AuraEngine") + self.logger = logging.getLogger("engine") self.playlist_folder = self.config.abs_playlist_path() def spread(self, entries): @@ -136,7 +136,6 @@ class M3UPlaylistProcessor: for entry in entries: # It's a M3U Playlist which needs to be spread if "uri" in entry and entry["uri"].startswith("playlist://"): - playlist_name = entry["uri"].split("playlist://")[1] self.logger.info(f"Spreading entries of M3U playlist '{playlist_name}'") m3u_entries = self.read_m3u_file(self.playlist_folder + playlist_name) @@ -185,7 +184,7 @@ class TimeslotRenderer: programme = None def __init__(self, scheduler): - self.logger = logging.getLogger("AuraEngine") + self.logger = logging.getLogger("engine") self.scheduler = scheduler self.programme = scheduler.get_programme() @@ -283,7 +282,6 @@ class TimeslotRenderer: for timeslot in next_timeslots: (playlist_type, resolved_playlist) = self.scheduler.resolve_playlist(timeslot) if resolved_playlist: - s += "\n│ Queued timeslot %s " % timeslot s += "\n│ └── Playlist %s (Type: %s)" % ( resolved_playlist, @@ -355,7 +353,6 @@ class TimeslotRenderer: clean_entries = [] for entry in entries: - if entry.entry_start >= entry.playlist.timeslot.timeslot_end: msg = "Filtered entry (%s) after end-of timeslot (%s) ... SKIPPED" % ( entry,