Skip to content

Commit

Permalink
feat(Processing/Config): Use new audio_path setting.
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Configuration settings `base_path` and `audio_folder`
have been removed and replaced with new merged `audio_path` setting.
  • Loading branch information
bamdadsabbagh committed Jun 29, 2023
1 parent f990fca commit 43df9f0
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 29 deletions.
Binary file modified examples/common/config.xlsx
Binary file not shown.
2 changes: 1 addition & 1 deletion processing/processing/actions/run_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def run_files(env: Env):

bands = storage.get_config_bands()
expected_sample_rate = storage.get_expected_sample_rate()
audio_path = storage.get_audio_path()
audio_path = storage.read_audio_path()
files = storage.read_config_files()

storage.delete_files_features()
Expand Down
2 changes: 1 addition & 1 deletion processing/processing/actions/run_indicators.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def run_indicators(env: Env):

files = storage.read_files()
bands_frequencies = storage.get_bands_frequencies()
audio_path = storage.get_audio_path()
audio_path = storage.read_audio_path()

storage.delete_indicators()

Expand Down
11 changes: 0 additions & 11 deletions processing/processing/config/Config.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,20 +210,9 @@ def get_umap_seed(self) -> int:
def get_expected_sample_rate(self) -> int:
return self.__settings["expected_sample_rate"]

def get_base_path(self) -> str:
return self.__settings["base_path"]

def get_audio_folder(self) -> str:
return self.__settings["audio_folder"]

def get_audio_host(self) -> str:
return self.__settings["audio_host"]

def get_audio_path(self) -> str:
base_path = self.get_base_path()
audio_folder = self.get_audio_folder()
return f"{base_path}/{audio_folder}"

def get_files(self) -> ConfigFiles:
return self.__files

Expand Down
3 changes: 1 addition & 2 deletions processing/processing/settings/ConfigSetting.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

# INFO: The interface for `Config.__settings` class attribute.
class ConfigSettings(TypedDict):
base_path: str
audio_folder: str
audio_path: str
audio_host: str
expected_sample_rate: int
timezone: str
Expand Down
4 changes: 2 additions & 2 deletions processing/processing/settings/StorageSetting.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# INFO: Enumeration of the actual namings of settings
# within the Excel configuration file.
class StorageSetting(Enum):
base_path = "base_path"
audio_folder = "audio_folder"
audio_path = "audio_path"
audio_host = "audio_host"
expected_sample_rate = "expected_sample_rate"
timezone = "timezone"
umap_seed = "umap_seed"
Expand Down
22 changes: 10 additions & 12 deletions processing/processing/storage/Storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,21 +506,19 @@ def get_expected_sample_rate(self) -> int:
settings = self.read_settings()
return settings["expected_sample_rate"]

def get_base_path(self) -> str:
if Env().is_docker is True:
return DOCKER_BASE_PATH

def read_audio_path(self) -> str:
settings = self.read_settings()
return settings["base_path"]
audio_path = settings["audio_path"]
print(audio_path)

def get_audio_folder(self) -> str:
settings = self.read_settings()
return settings["audio_folder"]
if Env().is_docker is True:
base_path = DOCKER_BASE_PATH
audio_folder = audio_path.split("/")[-1]
docker_path = f"{base_path}/{audio_path}"
print(docker_path)
return docker_path

def get_audio_path(self) -> str:
base_path = self.get_base_path()
audio_folder = self.get_audio_folder()
return f"{base_path}/{audio_folder}"
return audio_path

def create_configuration(self) -> None:
self.__file.create_group(StoragePath.configuration.value)
Expand Down

0 comments on commit 43df9f0

Please sign in to comment.