Fixed the "cannot import name '_download_progress'" error by:

Adding a shared progress_tracker instance in processor/init.py
Exposing public functions that wrap the ProgressTracker methods
Removing direct access to private _download_progress variable
Fixed the "'QueueItem' object has no attribute 'retry_count'" error by:

Updating the QueueItem class in queue/models.py to use retry_count instead of retries
This matches the field name used in the queue manager's implementation
This commit is contained in:
pacnpal
2024-11-15 19:19:46 +00:00
parent 12810273a6
commit 2e2951e714
6 changed files with 329 additions and 61 deletions

View File

@@ -6,6 +6,7 @@ from .progress_tracker import ProgressTracker
from .message_handler import MessageHandler
from .queue_handler import QueueHandler
# Export public classes and constants
__all__ = [
'VideoProcessor',
'REACTIONS',
@@ -13,3 +14,27 @@ __all__ = [
'MessageHandler',
'QueueHandler'
]
# Create a shared progress tracker instance for module-level access
progress_tracker = ProgressTracker()
# Export progress tracking functions that wrap the instance methods
def update_download_progress(url, progress_data):
"""Update download progress for a specific URL"""
progress_tracker.update_download_progress(url, progress_data)
def complete_download(url):
"""Mark a download as complete"""
progress_tracker.complete_download(url)
def increment_download_retries(url):
"""Increment retry count for a download"""
progress_tracker.increment_download_retries(url)
def get_download_progress(url=None):
"""Get download progress for a specific URL or all downloads"""
return progress_tracker.get_download_progress(url)
def get_active_operations():
"""Get all active operations"""
return progress_tracker.get_active_operations()