Skip to content

Commit

Permalink
FFmpeg Management:
Browse files Browse the repository at this point in the history
Updated extraction logic to handle BtbN's new archive structure with binaries in the bin directory
Added fallback to old structure for backward compatibility
Improved binary verification and permissions handling
Enhanced error handling during extraction and verification
Error Handling:

Added specific exception types for different errors
Better error propagation through the system
Improved error logging and user feedback
Enhanced cleanup on errors
Resource Management:

Better cleanup of failed downloads
Proper handling of temporary files
Enhanced queue management
Improved file deletion with retries
Verification:

FFmpeg binary verification with version checks
Video file integrity verification
Compression result verification
Archive structure verification
The system now:

Properly handles FFmpeg's new archive structure
Better manages binary downloads and verification
Provides more detailed error messages
Cleans up resources properly
Shows appropriate reactions for different error types
  • Loading branch information
pacnpal committed Nov 15, 2024
1 parent c144fb3 commit 9824469
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions videoarchiver/ffmpeg/ffmpeg_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,19 @@ def _extract_zip(self, archive_path: Path, temp_dir: str):
with zipfile.ZipFile(archive_path, "r") as zip_ref:
binary_names = self._get_binary_names()
for binary_name in binary_names:
# BtbN's builds have binaries in bin directory
binary_files = [
f
for f in zip_ref.namelist()
if f.endswith(f"/{binary_name}") or f.endswith(f"\\{binary_name}")
if f.endswith(f"/bin/{binary_name}") or f.endswith(f"\\bin\\{binary_name}")
]
if not binary_files:
# Fallback to old structure
binary_files = [
f
for f in zip_ref.namelist()
if f.endswith(f"/{binary_name}") or f.endswith(f"\\{binary_name}")
]
if not binary_files:
raise DownloadError(f"{binary_name} not found in archive")

Expand All @@ -256,9 +264,15 @@ def _extract_tar(self, archive_path: Path, temp_dir: str):
with tarfile.open(archive_path, "r:xz") as tar_ref:
binary_names = self._get_binary_names()
for binary_name in binary_names:
# BtbN's builds have binaries in bin directory
binary_files = [
f for f in tar_ref.getnames() if f.endswith(f"/{binary_name}")
f for f in tar_ref.getnames() if f.endswith(f"/bin/{binary_name}")
]
if not binary_files:
# Fallback to old structure
binary_files = [
f for f in tar_ref.getnames() if f.endswith(f"/{binary_name}")
]
if not binary_files:
raise DownloadError(f"{binary_name} not found in archive")

Expand Down

0 comments on commit 9824469

Please sign in to comment.