parkpow / deep-license-plate-recognition

Automatic License Plate Recognition (ALPR) or Automatic Number Plate Recognition (ANPR) software that works with any camera.
https://platerecognizer.com/
MIT License
523 stars 122 forks source link

Added guide to utilize updated script #203

Closed dibonjohnseron closed 5 months ago

dibonjohnseron commented 5 months ago

Rewritten script in python and updated guide to schedule running of script for both Linux and Windows

github-actions[bot] commented 5 months ago

Risk Level 2 - /home/runner/work/deep-license-plate-recognition/deep-license-plate-recognition/stream/remove_images.py

The code changes introduce a script for deleting images and empty directories based on a time threshold. The risk is moderate due to potential data loss if used incorrectly. Here are some suggestions for improvement:

  1. Validation of --threshold Argument: The --threshold argument is restricted to the range [1-23] hours. Consider allowing a broader range or providing a clear reason for this limitation in the help message.

  2. Error Handling in delete_images: When an error occurs during file deletion, the script prints the error but continues. Consider if it might be better to halt execution or log the errors to a file for later review, depending on the use case.

  3. Use of print for Error Reporting: Instead of using print statements for error reporting, it might be more appropriate to use the logging module for better control over logging levels and destinations.

  4. Performance Consideration: The script uses rglob which can be slow for directories with a large number of files or subdirectories. If performance is a concern, consider alternatives or optimizations.

Example for using logging:

import logging

logging.basicConfig(level=logging.WARNING)
logger = logging.getLogger(__name__)

# Replace print statements with logger calls
logger.error(f\"Error deleting images: {e.filename} - {e.strerror}\")

🔍🚫🐢


Powered by Code Review GPT

dibonjohnseron commented 5 months ago

@dev-bon is it possible to add instructions to see logs? Just in case the script in cron fails for some reason.

Yes this had been added now.