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

feat: (XMP) add --copy-xmp argument #185

Closed danleyb2 closed 7 months ago

github-actions[bot] commented 7 months ago

Risk Level 2 - /home/runner/work/deep-license-plate-recognition/deep-license-plate-recognition/blur/main.py

The changes include adding new command-line arguments and handling them within the code. The risk is moderate due to the potential for unhandled edge cases or incorrect assumptions about the arguments' usage. Here are some suggestions:

  1. Ensure that the --blur-url argument is validated to be a well-formed URL before it is used in the requests.post call. This can prevent potential issues with malformed URLs.

    from urllib.parse import urlparse
    
    def is_valid_url(url):
       try:
           result = urlparse(url)
           return all([result.scheme, result.netloc])
       except ValueError:
           return False
    
    if not is_valid_url(args.blur_url):
       sys.exit(f'Invalid blur URL: {args.blur_url}')
  2. The process function now includes copy_exif and copy_xmp in the data payload for the POST request. Ensure that the server-side API is expecting these new fields and handles them appropriately.

  3. The --resume flag's default value is set to False explicitly, which is redundant since store_true actions default to False. This line can be removed for cleaner code.

  4. The logging configuration is updated without a clear reason. If the change is intentional, ensure that it does not affect other parts of the application that rely on the logging format.

  5. The process_dir function skips files that start with 'blur-', which assumes that all blurred images will have this prefix. Ensure that this assumption is communicated to users or documented appropriately.


๐Ÿ”—๐Ÿ”๐Ÿงน


Powered by Code Review GPT