diff --git a/journey_fm_app.py b/journey_fm_app.py index e4417d2..1d38d0c 100644 --- a/journey_fm_app.py +++ b/journey_fm_app.py @@ -155,7 +155,7 @@ class SetupWizard(QDialog): buttons = QDialogButtonBox( QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel ) - buttons.accepted.connect(self.accept) + buttons.accepted.connect(self.validate_and_accept) buttons.rejected.connect(self.reject) layout.addWidget(buttons) @@ -192,6 +192,14 @@ class SetupWizard(QDialog): 'SELECTED_STATIONS': ','.join(selected_stations) } + def validate_and_accept(self): + """Validate configuration before accepting""" + if not self.journey_fm_checkbox.isChecked() and not self.spirit_fm_checkbox.isChecked(): + QMessageBox.warning(self, "Validation Error", + "Please select at least one station to monitor.") + return + self.accept() + class LogViewer(QWidget): """Widget for viewing application logs""" def __init__(self, parent=None): diff --git a/main.py b/main.py index d2ab5dd..df5e50b 100644 --- a/main.py +++ b/main.py @@ -326,8 +326,9 @@ def main(): PLAYLIST_NAME = config.get('PLAYLIST_NAME', PLAYLIST_NAME) # Load selected stations selected_stations_str = config.get('SELECTED_STATIONS', 'journey_fm,spirit_fm') - if isinstance(selected_stations_str, str): - selected_stations = selected_stations_str.split(',') + if isinstance(selected_stations_str, str) and selected_stations_str: + selected_stations = [s for s in selected_stations_str.split(',') if s] + # If empty or invalid, keep default else: # If no config file, use defaults (GUI should handle this) pass