diff --git a/birdnet_analyzer/gui/multi_file.py b/birdnet_analyzer/gui/multi_file.py index ac426c3d..ade2135b 100644 --- a/birdnet_analyzer/gui/multi_file.py +++ b/birdnet_analyzer/gui/multi_file.py @@ -3,6 +3,7 @@ import birdnet_analyzer.localization as loc import birdnet_analyzer.gui.utils as gu import birdnet_analyzer.gui.analysis as ga +import birdnet_analyzer.config as cfg OUTPUT_TYPE_MAP = { @@ -44,6 +45,9 @@ def runBatchAnalysis( if species_list_choice == gu._CUSTOM_SPECIES: gu.validate(species_list_file, loc.localize("validation-no-species-list-selected")) + + if fmin is None or fmax is None or fmin < cfg.SIG_FMIN or fmax > cfg.SIG_FMAX or fmin > fmax: + raise gr.Error(f"{loc.localize('validation-no-valid-frequency')} [{cfg.SIG_FMIN}, {cfg.SIG_FMAX}]") return ga.runAnalysis( None, diff --git a/birdnet_analyzer/gui/single_file.py b/birdnet_analyzer/gui/single_file.py index cfe040d8..fee42277 100644 --- a/birdnet_analyzer/gui/single_file.py +++ b/birdnet_analyzer/gui/single_file.py @@ -5,6 +5,7 @@ import birdnet_analyzer.localization as loc import birdnet_analyzer.gui.utils as gu import birdnet_analyzer.gui.analysis as ga +import birdnet_analyzer.config as cfg def runSingleFileAnalysis( @@ -27,7 +28,13 @@ def runSingleFileAnalysis( import csv from datetime import timedelta + if species_list_choice == gu._CUSTOM_SPECIES: + gu.validate(species_list_file, loc.localize("validation-no-species-list-selected")) + gu.validate(input_path, loc.localize("validation-no-file-selected")) + + if fmin is None or fmax is None or fmin < cfg.SIG_FMIN or fmax > cfg.SIG_FMAX or fmin > fmax: + raise gr.Error(f"{loc.localize('validation-no-valid-frequency')} [{cfg.SIG_FMIN}, {cfg.SIG_FMAX}]") result_filepath = ga.runAnalysis( input_path, diff --git a/birdnet_analyzer/gui/species.py b/birdnet_analyzer/gui/species.py index f1b2e3f9..f1558a6e 100644 --- a/birdnet_analyzer/gui/species.py +++ b/birdnet_analyzer/gui/species.py @@ -40,7 +40,7 @@ def select_directory_and_update_tb(name_tb): loc.set_state("species-output-dir", dir_name) return ( dir_name, - gr.Textbox(label=dir_name[0] + os.sep, visible=True, value=name_tb), + gr.Textbox(label=dir_name, visible=True, value=name_tb), ) return None, name_tb diff --git a/birdnet_analyzer/gui/train.py b/birdnet_analyzer/gui/train.py index eca43859..8fa4d2c9 100644 --- a/birdnet_analyzer/gui/train.py +++ b/birdnet_analyzer/gui/train.py @@ -224,7 +224,7 @@ def select_directory_and_update_tb(): if dir_name: return ( dir_name, - gr.Textbox(label=dir_name + os.sep, visible=True), + gr.Textbox(label=dir_name, visible=True), gr.Radio(visible=True, interactive=True), ) @@ -401,8 +401,8 @@ def select_directory_and_update(): if dir_name: return ( - dir_name[0], - gr.Textbox(label=dir_name[0] + "\\", visible=True), + dir_name, + gr.Textbox(label=dir_name, visible=True), ) return None, None