Skip to content

Conversation

@michaelos443
Copy link
Owner

Overview

This PR enhances the join_flv.py module to handle corrupted FLV files properly during the merging process. Instead of failing when encountering corrupted files, the module now validates each file, skips invalid ones, and continues with valid files.

Changes

Added

  • New validate_flv() function to check file integrity before processing
  • Comprehensive validation for FLV headers, metadata, and content tags
  • New test file test_join_flv_validation.py with extensive test cases

Modified

  • Refactored read_flv_header(), read_tag(), and read_meta_tag() to return meaningful values instead of raising exceptions
  • Enhanced concat_flv() to validate files, skip corrupted ones, and provide informative warnings
  • Improved guess_output() to better handle common filename patterns
  • Updated main() function with proper error handling

Fixed

  • Timestamp handling during tag merging to prevent reference errors
  • Resource management with proper file closing and cleanup
  • Error handling to prevent crashes on corrupted files

Testing

Added comprehensive tests for all validation scenarios including:

  • Non-existent files
  • Files that are too small
  • Files with invalid headers
  • Files with missing or corrupted metadata
  • Files with only metadata but no content

All tests pass successfully, and the module now gracefully handles corrupted files while still producing valid output when possible.


Pull Request opened by Augment Code with guidance from the PR author


Pull Request opened by Augment Code with guidance from the PR author

@michaelos443
Copy link
Owner Author

@Augment review

@michaelos443
Copy link
Owner Author

augment review

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