Commit 1e082c76 authored by David Trattnig's avatar David Trattnig
Browse files

Absolute audio path config. #72

parent 80f9985f
......@@ -68,10 +68,10 @@ api_engine_store_health="http://localhost:8008/api/v1/source/health/${ENGINE_NUM
[scheduler]
# Base path as seen by "engine-core", not accessed by "engine"; this is required to construct the absolute audio file path (check "Audio Store" in the docs)
# Either provide an absolute base path or a relative one starting in the `engine-core/src` directory. In case of `engine-core` running in docker use `/var/audio/source`
audio_source_folder="../audio/source"
audio_source_folder="audio/source"
audio_source_extension=".flac"
# Folder holding M3U Playlists to be scheduled in form of Engine Playlists (similar as audio source folder above)
audio_playlist_folder="../audio/playlist"
audio_playlist_folder="audio/playlist"
# Offset in seconds how long it takes for Liquidsoap to actually execute a scheduler command; Crucial to keep things in sync
engine_latency_offset=0.5
# How often should the calendar be fetched in seconds. This determines the time of the last changes applied, before a specific show aired
......
......@@ -68,10 +68,10 @@ api_engine_store_health="http://localhost:8008/api/v1/source/health/${ENGINE_NUM
[scheduler]
# Base path as seen by "engine-core", not accessed by "engine"; this is required to construct the absolute audio file path (check "Audio Store" in the docs)
# Either provide an absolute base path or a relative one starting in the `engine-core/src` directory. In case of `engine-core` running in docker use `/var/audio/source`
audio_source_folder="../audio/source"
audio_source_folder="audio/source"
audio_source_extension=".flac"
# Folder holding M3U Playlists to be scheduled in form of Engine Playlists (similar as audio source folder above)
audio_playlist_folder="../audio/playlist"
audio_playlist_folder="audio/playlist"
# Offset in seconds how long it takes for Liquidsoap to actually execute a scheduler command; Crucial to keep things in sync
engine_latency_offset=0.5
# How often should the calendar be fetched in seconds. This determines the time of the last changes applied, before a specific show aired
......
......@@ -153,3 +153,17 @@ class AuraConfig:
return path
else:
return self.get("install_dir") + "/" + path
def abs_audio_store_path(self):
"""
Returns the absolute path to the audio store, based on the `audio_source_folder` setting.
"""
return self.to_abs_path(self.get("audio_source_folder"))
def abs_playlist_path(self):
"""
Returns the absolute path to the playlist folder
"""
return self.to_abs_path(self.get("audio_playlist_folder"))
......@@ -537,7 +537,7 @@ class Player:
raise InvalidChannelException
self.connector.enable_transaction()
audio_store = self.config.get("audio_source_folder")
audio_store = self.config.abs_audio_store_path()
extension = self.config.get("audio_source_extension")
filepath = ResourceUtil.source_to_filepath(audio_store, source, extension)
self.logger.info(SU.pink(f"{channel}.queue_push('{filepath}')"))
......
......@@ -243,7 +243,7 @@ class AuraMonitor:
self.engine.player.connector.enable_transaction()
self.status["lqs"]["active"] = self.engine.is_connected()
self.engine.player.connector.disable_transaction()
self.status["audio_source"] = self.validate_directory(self.config.get("audio_source_folder"))
self.status["audio_source"] = self.validate_directory(self.config.abs_audio_store_path())
# After first update start the Heartbeat Monitor
if not self.heartbeat_running:
......
......@@ -392,7 +392,7 @@ class Playlog:
def resolve_entry(self, uri):
"""
Retrieves the playlog matching the provied file URI.
Retrieves the playlog matching the provided file URI.
Args:
path (String): The URI of the resource
......@@ -407,7 +407,7 @@ class Playlog:
entry_source = entry.source
if entry.get_content_type() in ResourceClass.FILE.types:
base_dir = self.config.get("audio_source_folder")
base_dir = self.config.abs_audio_store_path()
extension = self.config.get("audio_source_extension")
entry_source = ResourceUtil.source_to_filepath(base_dir, entry.source, extension)
if entry_source == uri:
......
......@@ -108,9 +108,7 @@ class M3UPlaylistProcessor():
"""
self.config = AuraConfig.config()
self.logger = logging.getLogger("AuraEngine")
self.playlist_folder = self.config.get("audio_playlist_folder")
if not self.playlist_folder.endswith("/"):
self.playlist_folder += "/"
self.playlist_folder = self.config.abs_playlist_path()
......
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