Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option for not analyzing files that have been analyzed #95

Closed
BenCretois opened this issue Apr 17, 2023 · 1 comment · Fixed by #316
Closed

Add an option for not analyzing files that have been analyzed #95

BenCretois opened this issue Apr 17, 2023 · 1 comment · Fixed by #316
Labels

Comments

@BenCretois
Copy link

When dealing with large amount of data (and thus long processing time) the server can unexpectedly crash, shutting down the analysis. It would be great if there was an option for avoiding the analysis of files that have already been analyzed.

I made a very quick fix but I am pretty much sure this can be optimized. In the function analyzeFile I added:

def analyzeFile(item):

    # Get file path and restore cfg
    fpath = item[0]
    cfg.setConfig(item[1])

    # CUSTOM - CHECK IF THE FILE ALREADY EXISTS
    rpath = fpath.replace(cfg.INPUT_PATH, '')
    rpath = rpath[1:] if rpath[0] in ['/', '\\'] else rpath

    # Check if file already exists and if it does skip the analysis
    if cfg.RESULT_TYPE == 'table':
        rtype = '.BirdNET.selection.table.txt' 
    elif cfg.RESULT_TYPE == 'audacity':
        rtype = '.BirdNET.results.txt'
    else:
        rtype = '.BirdNET.results.csv'

    outname = os.path.join(cfg.OUTPUT_PATH, rpath.rsplit('.', 1)[0] + rtype)

    if os.path.exists(outname):
        print("File {} already exists".format(outname))
    else:
        DO THE REST OF THE ANALYSIS
@Andx667 Andx667 added type: enhancement New feature or request area: Analyzer labels Apr 18, 2023
@Josef-Haupt
Copy link
Collaborator

Hi! Something like this is on our agenda and will also be added to the GUI. Thanks for sharing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants