Skip to content

Conversation

@Josef-Haupt
Copy link
Member

  • the result table in the batch analysis tab now shows all invalid files with the corresponding error message

@Josef-Haupt Josef-Haupt requested a review from Copilot November 3, 2025 12:18
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances error handling for audio file analysis failures by providing specific error messages and reasons for failures. The changes improve user feedback by displaying both the invalid file paths and the specific reasons for failure (e.g., unrecognized format).

Key changes:

  • Modified error handling to return specific error messages instead of None when file analysis fails
  • Updated UI to display a two-column table showing invalid files and their failure reasons, or a success message when all files are processed
  • Added localized strings for the new error messages and table headers across multiple languages

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
birdnet_analyzer/analyze/utils.py Modified analyze_file() to return error messages as strings instead of None, updated combine_results() to handle string error results
birdnet_analyzer/gui/analysis.py Updated return logic to preserve error message strings and handle both dict and string return types
birdnet_analyzer/gui/single_file.py Enhanced error display to include the specific error message from failed analysis
birdnet_analyzer/gui/multi_file.py Added error reason mapping and updated result grid to show both file paths and error reasons in two columns
birdnet_analyzer/lang/*.json Added localization strings for error messages and new column headers across 10 languages
Comments suppressed due to low confidence (3)

birdnet_analyzer/analyze/utils.py:704

  • The return type annotation is outdated. The function now returns dict[str, str] | str instead of dict[str, str] | None, as error cases return error message strings rather than None.
def analyze_file(item) -> dict[str, str] | None:

birdnet_analyzer/analyze/utils.py:716

  • The docstring is outdated. The return type should be documented as 'dict or str' instead of 'dict or None', and should clarify that a string error message is returned when errors occur, while None is returned only when files are skipped.
    """
    Analyzes an audio file and generates prediction results.

    Args:
        item (tuple): A tuple containing the file path (str) and configuration settings.

    Returns:
        dict or None: A dictionary of result file names if analysis is successful,
                      None if the file is skipped or an error occurs.
    Raises:
        Exception: If there is an error in reading the audio file or saving the results.
    """

birdnet_analyzer/analyze/utils.py:727

  • The TODO comment suggests uncertainty about the return value for skipped files. With the new error handling approach returning strings for failures, this inconsistency should be addressed - consider whether skipped files should also return a descriptive string for consistency, or update the TODO to reflect the current design decision.
        return None  # or return path to combine later? TODO

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Josef-Haupt Josef-Haupt merged commit c2c52fb into main Nov 3, 2025
7 checks passed
@Josef-Haupt Josef-Haupt deleted the updated-result-view branch November 3, 2025 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants